Hook to get the query result after listing posts

Hook to get the query result after listing posts Use the loop_end hook – it passes the WP_Query by reference. add_action( ‘loop_end’, ‘wpse_263822_loop_end’, 10, 1 ); function wpse_263822_loop_end( $query ) { //* Make sure we’re in the loop if( ! in_the_loop() ) { return; } //* Do something useful with the WP_Query print_r( $query->posts ); … Read more

customizing a theme [closed]

This is a very very broad question, probably isn’t the place for it tbh. But anyway, there are many many themes in existence already, you can modify them, generally by adding a child theme and making your modifications there, it is bad practice to update a theme directly. If you wish to extend the functionality … Read more

Instead of Custom CSS Theme CSS is loading

It is not clear if you want to just override the styles or replace the file with a new one. Whatever the case is, below code will help. Just wait for the best answer to your question. add_action( ‘wp_enqueue_scripts’, ‘add_my_style_css_also’, 99 ); function add_my_style_css_also() { wp_enqueue_style( ‘my-styles-css’, get_stylesheet_directory_uri() . ‘/style123.css’ ); } The code will … Read more

Adding padding above menu

This forum is specific to WordPress internal workaround and your question is regarding element styling which does not belong here. Please try to use specific sites according to your question. For your problem, add the following lines in your theme’s stylesheet and it should be fixed. #masthead #cms-header.header-ontop { padding-top:15px; } #masthead #cms-header.header-sticky { padding-top:0; … Read more

Adding a script & php to functions.php

First you should include this code in your footer.php – or similar. Second: if ( is_product() ) { //you are already in php function add_klaviyo_script() { echo ‘<?php // dont need to echo php $ItemId = $product->id; // and variables The solution(footer.php): <footer> …things </footer> <?php if ( is_product() ) { $ImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id( … Read more