Tag Info

New answers tagged

2

You can build a stack of unique tags, then loop over them again to output. Couple of extra things though - never use query_posts. Secondly, you can be way more efficient in your querying and save a lot of memory in the process: $post_ids = get_posts( array( 'posts_per_page' => -1, 'category_name' => 'testing', 'fields' ...


0

Comparator IN expects an array of values. Try to put your own values in arrays : $hobbiesvalue = array( get_field('hobbies_query') ); $sportsvalue = array( get_field('sports_query') ); $resultnum = array( get_field('number_of_results_to_show') ); I think using IN in this case may not be the best, but it should do the trick. You can also try to replace IN ...


0

By default WP_Query() will query posts (unless tax_query is set). You can change this by setting the post_type key in your $args array. To search for the same post type as is being currently viewed you can do the following: $args=array( 'post_type' => get_post_type(), //gets the post type of the current 'post' 'tag__in' => ...


2

If you look at wp_get_archives() you will notice that the link is generated by get_archives_link(). That function supplies a filter that will allow you to replace the parens. This is fairly crude but does work. function archive_link_wpse_183665($link) { $pat = '|\(([^)])\)</li>|'; // preg_match($pat,$link,$matches); // var_dump($matches); ...


1

I haven't looked in detail at your code, but what strikes me is your open_csv method. You have the following lines return $attributes['file']; return $attributes['type']; As your method currently stands, it stops and returns the value of file right after setting the attributes. Here is what return does in php If called from within a function, theĀ ...


0

Ok i was a bit headblocked; with the following snippet i was able to get things working as expected: $media = abc_attachments( $post->ID ); $arrayofids = array(); foreach( $media as $key ) { array_push($arrayofids, $key->ID); } preprint($arrayofids); Which lead to the following output: Array ( [0] => 1072 ...


2

This is more php, but you can use in_array(). Just check if the current post type is in array in $hide_sidebar. You can do the following $hide_sidebar = array('example1', 'example2', 'example3'); //hide sidebar on these post types if ( in_array( get_post_type(), $hide_sidebar ) ) { // Do something if the post type is in array } or the negative ...



Top 50 recent answers are included