How to display the content for given page ID withot the wrapper?

How to display the content for given page ID withot the <p></p> wrapper? The method I’m currently using is: <?php $id=21; $post = get_page($id); $content = apply_filters(‘the_content’, $post->post_content); echo $content; ?> For example page ID = 21 has the following content: Some content What the wordpress echo is <p>Some content</p> Any suggestion much appreciated. 2 … Read more

Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?

I am literally clueless as to why the code does not function properly on the first page, but functions as expected on the second page. The second query should return the latest 3 posts in the pagination loop, yet it also returns posts from the first query. Instead of 3 posts on the homepage, there … Read more

The best way to add stylesheets to WordPress

I am in the process of converting a mobile responsive page, currently built in Bootstrap into WordPress. Using wp_register_style() and wp_enqueue_style() will add the stylesheets to all pages, including the wp-admin. I know I could get around that by using an if ( ! is_admin() ) conditional statement. Is it better to use the conditional … Read more

How to correctly add JQuery in a WP theme?

I am pretty new in WordPress and I have the following doubt: I have to include JQuery into a theme and I am doing in this way: I create the following function into functions.php theme file and I add it as action: function load_java_scripts() { // Load FlexSlider JavaScript that handle the SlideShow: wp_enqueue_script(‘jQuery-js’, ‘http://code.jquery.com/jquery.js’, … Read more

How to get the URI to a theme without the domain. Example: /wp-content/themes/my-theme

I basically want the output of get_stylesheet_directory_uri(), but without http(s) and the domain. 2 Answers 2 Use parse_url(), because it exists exactly for that reason: $path = parse_url( get_stylesheet_directory_uri(), PHP_URL_PATH ); Chris Cox’ solution will fail when the wp-content directory runs under a different domain than the rest of the site.

Understanding the WordPress template hierarchy

I watched a lot of courses about WordPress Development on Udemy. Also I’ve almost finished my “WordPress Development” track on Teamtreehouse, but I can’t understand one simple thing, because one course a little bit contradicts another. My question is about page.php, content.php and single.php. What is the best practice to use these files? For example, … Read more

Unhook action from child theme

I have decided to use a WooCommerce Storefront child theme called Galleria, when I have previously used the Storefront theme I have used the common remove_action to unhook the defaults and replaced with my own add_action. However as Galleria is a child theme of Storefront, it has its own add_action in the file class-galleria-structure.php though … Read more