Include style.css in the Child Theme with PHP

You posted in a comment that the current theme uses the following code in its header.php <link rel=”stylesheet” href=”https://wordpress.stackexchange.com/questions/318269/<?php bloginfo(“template_url’); ?>/style.css” type=”text/css” media=”screen”/> This is not WordPress best practice and hence the linked tutorials fail you. How to go on from this? Copy header.php from parent to child theme, remove the line containing style.css, then … Read more

Template Loop – add switch case php

if ( $query->have_posts() ) : ?> <ul id=”list-con”> <?php while ($query->have_posts()) : $query->the_post(); ?> <?php switch ( get_post_type( $post->ID ) ) { case “firstcase”: ?> <li>code as defined above</li> <?php break; case “secondcase”: ?> <li>another code as defined above</li> <?php break; } ?> <?php endwhile; ?> </ul> <?php endif;

Co-Authors Plus: How do I get all authors with a query?

If you are using Co-Authors Plus plugin. By default, it will show the original author of the post. You’ll need to edit theme files with the code responsible for showing the author name for posts. This could be single.php, content.php, or a template tag in your theme’s functions.php file. the_author_posts_link() and you will need to … Read more

Shortcode to pull posts

UPDATE Turns out the issue was with the first page of posts. I needed to account for page 1 when calling the ajax load more. Since this is a shortcode and not a template my query vars were not passing along to the ajax call. I resolved the issue by passing the page as a … Read more

WordPress PHP command and ELSE IF problem

It could work like this; but you need to use get_field() instead of the_field(), since the latter displays the field instead of returning a value. See https://www.advancedcustomfields.com/resources/the_field/ for more information.

Getting different user data depending on where I use variable

I’ve only seen some parts of your code, but I guess I know where the problem lies… If this is what you’re printing in the loop: <script type=”text/javascript”> jQuery(document).ready(function($) { $(‘.callback’).val(‘<?php echo $user->first_name; ?> <?php echo $user->last_name; ?>’); }); </script> <?php echo do_shortcode( ‘[contact-form-7 id=”12345″]’ ); ?> And you want to output multiple forms on … Read more

Cant display an image via PHP in wordpress

I think that you need echo the image, try this: <php $image = wp_get_attachment_image_src( $post_thumbnail_id ); //echo( $image[0] ); ?> <img src=”https://wordpress.stackexchange.com/questions/319794/<?php echo $image[0]; ?>” alt=””>