WP_Query Class custom field parameters

As I understand it, IN, NOT IN, or BETWEEN work essentially like the MySQL operators of the same name. They are just abstracted somewhat. However, it sounds to me like you don’t need to worry about that. Your description makes me think that you are only worried about the meta_key itself and not any particular … Read more

Links in the_content not linked

Running make_clickable on the_content will get you your links. So… apply_filters(‘the_content’,’make_clickable’); … in your functions.php should link your content. It will be simple but you should get hyperlinks. I don’t see a way to add the target=”_blank” part. make_clickable is in wp-includes/formatting.php. You could use it as a pattern for a function that would add … Read more

Add content depending on page loaded

Assuming that you want to output content conditionally, depending on whether you are on a given set of static pages, by Page ID, you can simply wrap your code in an is_page() conditional. To determine if the current user is logged in, you can use the is_user_logged_in() conditional. For example // Array of Page IDs … Read more

Excluded category from loop

Can’t really help with custom Genesis code, but the WordPress way to modify the main loop is to filter pre_get_posts. To exclude Category ID 7 from contexts other than single post pages: function wpse72961_filter_pre_get_posts( $query ) { if ( is_main_query() && ! is_singular() ) { $query->set( ‘category__not_in’, 7 ); } return; } add_action( ‘pre_get_posts’, ‘wpse72961_filter_pre_get_posts’ … Read more

Help with if statement inside while loop

You’re setting $id = $post->ID; outside of the loop for agent_type posts, it’ll never match. Anyway, if you’re not doing anything with the agent_type posts that don’t match, just query for the one post you want by its ID: $list_agent = get_post_meta( $post->ID,’ec_agents’,true ); $args = array( ‘post_type’ => ‘agent_type’, ‘p’ => $list_agent ); $agent_query … Read more

How to query for a page, get data, then query for child pages of that page

I don’t understand the distinction you are making between ‘sublevel’ query and ‘toplevel’ query, but this is how I pull children for a page. $children = get_children( array( ‘post_parent’ => $servid, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ )); ?> Or… $page_children = get_pages( array( ‘child_of’ => $post->ID, ‘post_type’ => … Read more