How to get url image page the right way?

Im guessing it is because you are using echo the_post_thumbnail_url(array(300, 150)); instead of the_post_thumbnail_url(array(300, 150)); the_post_thumbnail_url echos the output for you. Another observation, the the_post_thumbnail_url uses the post data that is setup using setup_postdata, so there is no need for these two lines: $thumb_id = get_post_thumbnail_id($post, ‘news-image’); $url = wp_get_attachment_thumb_url($thumb_id, ‘300, 300’);

Dynamic sidebar areas not working on the Theme Customizer

Creating new query objects is not a good idea in this situation. Try simply getting the pages and using those objects to serve up the widget areas: add_action( ‘widgets_init’, ‘my_243057_widgets_init’ ); function my_243057_widgets_init() { /** * Get only published page objects * @link: https://codex.wordpress.org/Function_Reference/get_pages */ $pages = get_pages(); foreach ( $pages as $page ) { … Read more

hide/show a div in wordpress

Detecting index.php specifically may not be the best option because this template file is used in many cases in WordPress. Eventually, all pages will fall back to using index.php if no other template file is associated with this page. So instead of targeting index.php, get familiar with template hierarchy and try to use conditional tags, … Read more