Tag Info

New answers tagged

0

If you place the code below in single.php file anywhere you want the links to appear in your posts, or inside a function in functions.php and the function tied to a filter or an action like 'the_content', the you shold get a list of links to the posts that have the same tag or tags as the post you are currently reading. global $post; ...


1

$count is just an arbitrary variable name. If you're using a separate loop to get tags and stop after a certain number (as shown on https://codex.wordpress.org/Function_Reference/get_the_tags), replace the $count variable in that example code with something like $tag_count or $counting or $treebark, and it won't mess up your use of $count in the posts Loop ...


0

If I understand what you want I would call it on the save_post hook: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post So the code would be something a little like: function wphuyeh8_save_post_tag( $post_id, $post, $update ) { // If example is set and not false if($_REQUEST['_example']): // set the tag ...


1

It is quite easy to achieve this. Your answer is usort() FEW NOTES: Before we code, just a few notes Requires PHP5.4+ due to the use of the short array syntax ([]). If you have an older version, you should really upgrade as older versions are a real security threat as all older versions prior to PHP 5.4 has been EOL'ed I will comment the code as I go ...


0

By default, WP doesn't sort by taxonomy/tag. A probable solution is doing 3 separate get_posts calls, one for each tag, then using array_merge to combine the results into 1 array.


0

tag__in is not listed as a valid orderby value in the codex. I'd suggest grabbing more posts than you need, and ordering them within your PHP.


0

I think you can do this by following way - Install the plugin https://wordpress.org/plugins/json-rest-api/ on the site from where you want to pull the posts. It makes the WordPress data available in json format. It is also possible to filter the request to get specific data. You can read the documentation in detail here at http://v2.wp-api.org Look for ...


0

Can't you just use this: <?php the_tags( '<span class="tags">', ', ', '</span>' ); ?> https://codex.wordpress.org/Function_Reference/the_tags get_terms gives you all the tags from your site I think.


0

Solution 1) First, make sure you are using WordPress 4.3, which was just released, or this won't work. 2) Second, drop the entire pre_get_posts hook, you won't need it. WordPress will automatically filter the search archive based on the terms you've included in the querystring (this is the 4.3 functionality I just mentioned). 3) Next, replace your call to ...


0

As per the ACF documentation, you must pass either the term and term ID or the term object to the get_fields() function for a taxonomy. So in your case, you would replace $tag_image = get_field('tag_image'); with: $tag_image = get_field('tag_image', $term);


1

Never modify Wordpress core files! Use your template's functions.php. You can check examples here: http://wordpress.stackexchange.com/a/198778/69451


0

Addition to TheDeadMedic's answer, to show ALL tags: if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' ) { unset( $args['number'] ); $args['hide_empty'] = 0; } return $args;


0

Each taxonomy object will have _builtin set to 1 for native taxonomies, so check $taxonomy->_builtin in your foreach loop first before fetching the terms.


0

Got it - just use this: <?php $query = new WP_Query( array( 'tag__in' => $tags ) ); ?>



Top 50 recent answers are included