Conditional On custom field plugin metabox

This can’t work because isset() returns true if there is a value, trueand false are values, ergo it won’t work. Do it like this instead: $premium = get_field(‘premium’); if ( ! $premium ) { // this is basically short for $premium == false echo ‘not premium’; }

List all pages including archive

Yep, this is definitely possible. Grab your post types and insert them in $post_types to loop through every one of them to manually generate the archives and posts: <?php // post types of your choice $post_types = array( ‘page’, ‘work’, ‘people’ ); $wp_cats = array(); foreach ( $post_types as $post_type ) { $pages = get_pages( … Read more

Compare Two Custom Post Types Using The Same Custom Taxonomy

Don’t use get_the_term_list() as it returns an HTML string, which makes comparing more difficult. Use wp_get_post_terms() (Codex link) instead. It can return an array, and then you can use something like array_intersect() to get the terms that match. Your code should look something like this (I haven’t tested this): $course_terms = wp_get_post_terms($course_post_id, ‘course_type’. array(‘fields’=>’slug’)); $testimonial_terms … Read more

Comparing Dates from custom field

Well, the exact server time/timestamp can be retrieve with current_time function. And comparing your date format, it would need to be Ymd. So combining these two thing, the proper comparison for you should be – $key = get_post_meta( $post->ID, ‘Due’, true ); $date = date(‘Ymd’, current_time(‘timestamp’) ); if( $key >= $date ) { // note … Read more

How to add ASCII symbol after each recent post [closed]

Are you talking about (something like) this: <?php $args = array( ‘numberposts’ => 2, ); $recent_posts = wp_get_recent_posts($args); foreach ($recent_posts as $recent) { ?> <li> <a href=”https://wordpress.stackexchange.com/questions/127441/<?php echo get_permalink($recent[“ID’]); ?>” title=”<?php echo esc_attr($recent[“post_title”]); ?>”> <?php echo $recent[“post_title”]; ?> </a> &gt; </li> <?php } ?> If so, what was the problem?

is user member of a group, show them categories [closed]

You should probably try this plugin first: http://buddydev.com/buddypress/blog-categories-for-groups-plugin/ Or you could take some code from it and try to implement that yourself. Start with blog-categories-for-groups.php, and see the last few lines: //for single post screen function screen_group_blog_single_post(){ global $bp; if(function_exists(‘bp_is_group’)&&!bp_is_group()) return; //do not catch the request for creating new post if(bp_is_action_variable(‘create’,0)) return; $current_group=groups_get_current_group(); if(bcg_is_disabled($current_group->id)) return; … Read more

How to add title attribute to archive items

If you look at the source, you will see that the HTML is generated by get_archives_link, which applies the filter get_archives_link. Applying a callback to that filter is probably the most straightforward way to add a title attribute. Unfortunately it is not one of the more friendly filters and requires you to regex the generated … Read more