Display Posts Query with IF function

If I understand you, you want to filter out faculty members who do not have any awards at the query stage. Replace your code: <?php query_posts( ‘post_type=mtt_page’); ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> with this (untested): <?php $args = array( ‘post_type’ => ‘mtt_page’, ‘posts_per_page’ => -1, ‘meta_query’ => … Read more

Custom Post taxonomy template

Turned out to be an internal mayashop function in the taxonomy.php page that checks for two particular taxonomies if found populates their pages it not returns to the index.php added my condition & all is well now, Thanks <?php /** * @package WordPress * @subpackage Impero * @since Impero 1.0 */ if ( yiw_is_portfolio_tax( get_query_var(‘taxonomy’) … Read more

Insert custom fields to a custom post type

That statement grabs a file called content-post-format.php in the theme directory, depending on the post format. Posts will grab content.php since there is no post format. Copy the information out of content.php into single-campsite.php and go from there. Alternatively, you can create a copy of content.php called content-campsite.php and call: <?php get_template_part( ‘content’, ‘campsite’ ); … Read more

New posts label category with “new”

In case anyone else is looking for this in the future, turns out the best way to do it is by using wp_get_recent_posts function. Someone knocked up an example that worked great for me: <?php $args = array( ‘numberposts’ => ‘1’ ); $recent_post = wp_get_recent_posts( $args ); if (strtotime($recent_post[0][‘post_date’]) > strtotime(‘-7 days’)) $class = “new!”; … Read more

Post visibility option to theme front-end for author to select?

Wherever you want to provide this functionality, put the following: <?php if (is_user_logged_in() && current_user_can(‘publish_posts’)) { $ID = get_the_ID(); $status = get_post_status($ID); ?> Visibility: <form id=”update_post_visibility” name=”update_post_visibility” method=”post” action=”/update-post-visibility”> <input id=”visibility-radio-public” type=”radio” <?php if ((‘publish’ === $status) && ! post_password_required($ID)) echo ‘checked=”checked” ‘; ?>value=”public” name=”visibility” /> <label for=”visibility-radio-public”>Public</label> <br /> <input id=”visibility-radio-password” type=”radio” <?php if … Read more