Modify php code to pass a page id as a parameter in order to create a breadcrumb

I simply had to remove ‘is_page() && ‘ in both the if and the elseif function the_ajax_breadcrumb($post_id) { ob_start(); $args = array(‘page_id’ => $post_id); $the_query = new WP_Query($args); $currentBefore=”<li><a>”; $currentAfter=”</a></li>”; while ( $the_query->have_posts() ) { $the_query->the_post(); if ( !is_home() && !is_front_page() || is_paged() ) { echo ‘<nav class=”breadcrumb”><ul>’; if ( !$the_query->post->post_parent ) { echo $currentBefore; … Read more

search results based on categories or custom fields

I’m not sure how much of a help this will be, but this is a (probably overly convoluted) snippet of code I wrote a few years ago for a shortcode to display posts by category. If nothing else it may at least put you on the right track. $featured_posts = get_posts( array( ‘category’ => $atts[‘cat’], … Read more

How can I show only if custom field has content [closed]

Again, I’m not familiar with Advanced Custom Fields but you may be able to store the returned value into a variable then test if that variable is empty, like so: <?php $pista1a = types_render_field(“pista-1a”, array(“argument1″=>”value1″,”argument2″=>”value2″,”argument2″=>”value2”)); ?> <ul> <?php if( ! empty( $pista1a ) ) : ?> <li> <?php echo $pista1a; ?> </li> <?php endif; ?> … Read more

How to fetch results from database

There is likely no “cp_job” column like you are thinking. extra data/information about a wordpress post type (it looks like ads is a custom post type here) would be stored as post meta in the database. So you might see something in the wp_post_meta table like: meta_id | post_id | meta_key | meta_value XX | … Read more