Tag Info

New answers tagged

0

To show dropdown with currently selected option, first you need to fetch current value. You can get that value from $_REQUEST variable. If you have grade variable then your current value is $_REQUEST['grade']. Eg. if ($_REQUEST['grade'] == $term->slug) Recommended: Do not use REQUEST variable directly without sanitization. Use function like esc_attr. If ...


0

$seach_values can be changed whenever the site redirect, be sure that $search_values still keeps the input values from your search form. To be sure I suggest use GET or POST to pass the values from form. So, your comparing statement should be $_GET['grades'] == $term->slug Here I suppose your search form use method="GET"


1

This can be easily done with your own custom function. What you want to do here is, get your object from get_terms() which will hold your term objects, check if your unique key is set as a parameter and then according to that, remove that key/pair and add it to the back Now, lets put that into code: (I have commented the code to make it easy to follow) ...


0

An idea that came to me is to add a term in your taxonomy called something like 'append' and then make the terms you want to be appended at the end of your terms list children of that term. Then it is only a matter of doing the appropriate term queries, ie get all terms with append as it's parent and then exclude them when quering for the rest. This way you ...


0

I stumbled across similar issue lately. If you are comfortable with using a plugin, you can install Custom Taxonomy Sort. Even though it was not updated for over two years, it solved the problem for me. Basically, it allows you to sort terms manually from the dashboard.


0

There may be a better way of doing this, but you could probably just do two queries. Maybe something along these lines (untested): $loner_term = X; //put whatever the id of the term you want at end $taxonomies = 'YOUR_TAXONOMY_NAME'; ) // get all of the alphabetical terms and exclude the one you need at the end $alpha_args = array( 'orderby' => ...


1

get_term_link() will return a WP_Error object on error. You can't print an object or array or you will get messages similar to what you are getting. Use var_dump() instead or print_r() and you should see what is occuring. Your error even tells you that WP_Error is the object involved. You are getting errors when the term you are looking for is not found. ...


1

The number of posts attached can be found here: $term->count. So you could do the following: $class_empty_term = ''; if( $term->count == 0 ) $class_empty_term = 'empty'; $term_list .= '<div class="' . $class_empty_term . ' grid__item ...">'; $term_list .= '<div class="panel text--center">';


0

Use the Switch statement. switch ($term->name) { case 'customtermincustomtaxonomy': // ... break; case 'anotherterm': // ... break; case 'somethingelse': // ... break; }



Top 50 recent answers are included