How to show all of aspecific post type that has taxonomy and a specific term

Why that $pages suddenly became $myposts!!? Anyway, I really don’t see any big issues with your code, however, you can try this.. <?php $pages = get_posts(array( ‘post_type’ => ‘directory_listing’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘place’, ‘field’ => ‘slug’, ‘terms’ => ‘place1’, ‘include_children’ => false ) )) ); foreach ($pages as $page) … Read more

Editing the contents of just one div on a page from wordpress

Welcome to WordPress development! It is a fantastic content management system. The normal way to display content for a particular page, on that page, is to use the WP function the_content();. This normally entails creating a simple WP loop to check for the existence of content, then perform certain actions (like creating the HTML to … Read more

Select All not working in a WordPress search filter

Couple of notes: Your form action is incorrect: <form method=”get” action=”http://www.adoptapet.ie/archive-farm/”>. The page is <form method=”get” action=”http://www.adoptapet.ie/archive-farms/”> You should reorder your argument list for adopt_custom_taxonomy_dropdown(). As written, most of your arguments have default values and can be omitted when the function is called, except that as written argument five doesn’t have a default so you … Read more

How to set a cookie based on a page Get variable?

On the page where you want to set the cookie write this code and check if(get_query_var(‘my_var’) == ‘somevalue’){ setcookie(‘my_cookie’, get_query_var(‘my_var’), strtotime(‘+1 day’)); } If we go with your code then it will set coookie on every page who having query variable ?my_var=somevalue

Functions are causing errors

You don’t want to add function vote_up() { […] } at the top of every post if you display more than one post on a page. You want to declare the vote_up() function in your plugin’s PHP file. Once the plugin declares the function, as long as the plugin is active, you can just call … Read more

Limit ads appearing more than three times

You could just make an easy counter – Untested though. <?php else : ?> <?php global $wp_query; ?> <?php $ads = 0; ?> <?php if ($ads < 3 && (($wp_query->current_post + 1) % 5 == 0 )): ?> <div class=”box”> <adsense code> </div> <?php $ads++; ?> <?php endif; ?>

Echo the featured image of page assigned to blog in index.php

when a page is set to be the posts page, then the ‘page_for_posts’ option will contain the page id of that page; in this case, you can output the featured image with: if( is_home() && get_option( ‘page_for_posts’ ) echo get_the_post_thumbnail( get_option( ‘page_for_posts’ ) );