Shortcode Displays 2 times
Shortcode Displays 2 times
Shortcode Displays 2 times
I seem to have solved it with the following code which I cobbled together from other answers after searching last 24hrs. It gave an error until I removed the restore_current_blog at the end of the function. As this should only be used by the singular page for the custom post type, I am hoping, it … Read more
How to display product variations on same row
That tutorial is for a classic PHP theme, but 2023 is a modern block theme, it works completely differently. You can’t put PHP in the HTML files in templates folder. You should think of these files as starting content, not PHP files, and any changes you make in the side editor are saved in the … Read more
I already got the solution myself. Just use this code, and you will get the Next/Previous post without a link: <?php previous_post(‘Previous Post’); ?> <?php next_post(‘Next Post’); ?>
Assuming you know the post ID for the specific post/type it’s easy enough yes, simply call get_the_date() with a specific ID. Adjust 1 to the appropriate value. <?php echo get_the_date( ”, 1 ); ?>
If you want to display the author’s name outside the loop, you must use the following code snippet. First answer: Your definite answer The code below first takes the ID of the author of the post. Then it displays the author name using the ID global $post; $get_AuthorId = $post->post_author; $getUser_name = get_userdata($get_AuthorId); echo $post_author … Read more
I’m still not quite too sure what happened here, but I reset WordPress without changing the theme and that resolved the issue. If I figure out what setting it was that caused it, I will post it here.
Filter template_include, check if the current post is a product and load the product template. Example: add_filter( ‘template_include’, function( $template ) { if ( ! is_singular() or ! get_post_meta( get_the_ID(), ‘price’, true ) ) return $template; return locate_template( ‘product-single.php’ ); }); How exactly you determine if a post is a product is up to your … Read more
Try to use filter like add_filter(‘the_title’, ‘new_title’, 10, 2); function new_title($title, $id) { if(‘your-post-type’ == get_post_type($id)) $title=”Add your DIV block here”; $title .= $title; return $title; }