The Content is not Wraping in tag

The function the_content() prints the content with a p tag itself. I mean, if you use echo ‘<p class=”our_p”>’ . the_content() . ‘</p>; It actually outputs- <p class=”our_p”><p>lorem ipsum dolor sit amet…</p></p> Use get_the_content() instead. It will return the unfiltered content. Something link this- echo ‘<p class=”our_p”>’ . get_the_content() . ‘</p>; Codex: https://codex.wordpress.org/Function_Reference/the_content

Where to place template files?

Using include makes it impossible to child theme that file. You will also find that some things that depend on global variables will not work. This is because the function that loads templates also globalizes a bunch of variables. You will also not trigger the actions attached to get_header, get_footer, and get_sidebar, which some plugin … Read more

Customizer – loading settings/controls/sections/panels based on a id/page id

The most robust way to do this is to do JavaScript-based instantiation of the sections, controls, and settings dynamically in response to the URL being previewed. Since you can navigate around the site in the preview, this will ensure that the post/page-specific sections and controls will be created as you need them when you navigate … Read more

How do I create my own .php file with a code part and echo it on different pages?

There’s a fundamental misunderstanding here about how partials/templates that aren’t full pages/template fragments in WP work. get_* is not how files are loaded, and get_header and get_footer are special cases for legacy reasons, kept for conventions sake. They’re actually equivalent to: get_template_part( ‘header’ ); get_template_part( ‘footer’ ); But with some additional filters and checks so … Read more

Can’t remove DIV from hooks in Storefront child theme [closed]

Storefront version 3.0: Code of the header.php in version 3.0 <header id=”masthead” class=”site-header” role=”banner” style=”<?php storefront_header_styles(); ?>”> <?php /** * Functions hooked into storefront_header action * * @hooked storefront_header_container – 0 * @hooked storefront_skip_links – 5 * @hooked storefront_social_icons – 10 * @hooked storefront_site_branding – 20 * @hooked storefront_secondary_navigation – 30 * @hooked storefront_product_search – … Read more

get_template_part for specific page

This is just a supplement to the other answer. I am trying to load fd-blog.php if it is the ‘Blog’ page, otherwise load the fd-default.php To actually load the template file, you should remove the dash (-): get_template_part( ‘inc/fd’, ‘blog’ ); // loads inc/fd-blog.php get_template_part( ‘inc/fd’, ‘default’ ); // loads inc/fd-default.php So just inc/fd, and … Read more