Loop on a wordpress Page instead of content coming from the WP text editor

On your custom page template, the default loop is working and that’s why the loop is fetching content from the page. You need a custom query in this case. Here’s the code. <?php $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) … Read more

Passing postid of Testimonial Custom Post in Shortcode Parameter

Well, maybe you shouldn’t set $args[‘posts id’] as this is not a supported argument for the get_posts function and instead use the “posts__in” argument or instead switch to the “get_post” function if you get the id parameter. Also, i’m not quite sure but i think you have to use quotes in the shortcode. So your … Read more

Appending an ACF custom field to the page title

If you need to append something to EVERY post_title you have, you should: Make your loop with WP Query, check Codex Then, use get_the_ID, to get the specific post ID, check Codex Then, use the ID to get the ACF field from that specific post like get_field(‘name-of-the-field), check the documentation Don’t forget to use wp_reset_query(), … Read more

Adding multiple conditional tags in a function?

You want to put those category IDs into an array really, the IF can only handle one condition at a time, so you could change your if statement to be: if( is_category(’16’) || is_category(’12’) ) { In PHP, the || stands for OR, whilst && stands for AND, so your if statement is saying if … Read more

Replace & with &

It looks like the function returning an url, And is always good practice to use esc_url(); wordpress function to escape all characters including the – & into &amp; before displaying. Example usage – return esc_url( $incomingLink );