Inject class in body when particular page template is used

there is a filter for that and it’s called… body_class 😉 This should work for your case: function add_my_custom_body_class( $classes ) { if ( is_page_template( ‘page-customer.php’ ) ) { $classes[] = ‘body_customer’; } return $classes; } add_filter( ‘body_class’, ‘add_my_custom_body_class’, 10, 1 ); if you wanna add class based on page ID (as you’ve mentioned in … Read more

I need help locating a URL that is on my site map, but that I can’t find in my WordPress dashboard

Keep in mind there’s really only a few actual pages in WordPress. Most URLs are getting redirected to index.php, parsed for the request information, and then processed accordingly. They are mostly posts in the end, which are pulled from the database and displayed according to one or more template files. The reason that’s important is … Read more

how to edit source code of specific page in wordpress?

Much of the code for any page, including header and footer, comes from your theme. If you want to create fully custom code, your best bet is to create a child theme (which just means creating a “style.css” file with some comments that refer to the parent theme, which is what you’re currently using) and … Read more

Would Gutenberg be considered a PlugIn?

It’s slightly complicated. The default editor in WordPress is what’s properly called the “block editor”, but while this editor was being developed it was known as the “Gutenberg” project. The development on Gutenberg was done in the form of a plugin, which people could install for the purposes of testing and contributing. When WordPress 5.0 … Read more

Permalink opens attachment instead of page

Attachments are stored with their filename (minus extension) as the post name. So if you uploaded an attachment that’s called map.xyz, it would have the same name as your page. So first, check your Media Library if you have a ‘map’ attachment. Secondly, check if your ‘map’ page still exists and still has the same … Read more

What is a subpage in WordPress?

The only difference between a page and a subpage is that a subpage contains it’s parent in the URL, as will any pages that sit as children to the child page… For illustration. Regular page: example.com/a-page/ Subpage: example.com/a-page/a-child-page/ Sub Subpage: example.com/a-page/a-child-page/another-child/ and so on… Aside from the URL there’s no other differences i can think … Read more

Using wp_list_pages() after calling query_posts()

This is for future askers, Whenever you use query_posts or custom wp_query you should add wp_reset_query(); after your loop or when you are done processing your posts. This little line of code will help in solving pagination issues or in your case rest the global $post the original as before your query.

Automatically create a new page daily with last three posts

You can create date.php (you can copy the content for this from archive.php or index.php) in your theme folder which will handle all the “day” pages… <?php get_header(); ?> <div id=”container”> <div id=”content” role=”main”> <?php $day = get_query_var(‘day’); $monthnum = get_query_var(‘monthnum’); $year = get_query_var(‘year’); if ( is_day() ) : ?> <a href=”https://wordpress.stackexchange.com/questions/15424/<?php echo get_day_link($year, $monthnum, … Read more