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

Sort on two variables

So long as every listing has a feature_posi field (even if it’s empty), you can let WordPress/MySQL handle the ordering for you: $args = array( ‘post_type’ => ‘listing’, ‘posts_per_page’ => -1, ‘orderby’ => ‘title meta_value_num’, ‘order’ => ‘ASC’, ‘meta_key’ => ‘feature_posi’, ‘tax_query’ => array( array( ‘taxonomy’ => $taxonomyName, ‘field’ => $term_slug, ‘terms’ => get_queried_object()->term_id, ) … Read more

Add multiple sections, settings and controls at once to the Customizer

I suppose you didn’t pass $wp_customize properly. I’d do this: Create a setting e.x. section_number which determine user’s choice Put the code to the customizer.php customizer.php add_action(‘customize_register’, ‘my_customizer’); function my_customizer($wp_customize){ $section_number = get_theme_mod(‘section_number’, 0); for($i = 0; $i <= $section_number; $i++) { $wp_customize->add_section( ‘slider_’.$i, array( ‘title’ => __( ‘Slider ‘.$slider, ‘Kraftzwerg’ ), ‘capability’ => ‘edit_theme_options’, … Read more

WordPress Menu Customizer

You can do this two ways. Add new section to existing nav_menus panel and then add your controls to the section: $wp_customize->add_section(‘my_section’, array( ‘title’ => ‘My options’, ‘panel’ => ‘nav_menus’ )); $wp_customize->add_setting(‘my_setting’, array( ‘type’ => ‘theme_mod’, ‘settings’ => ‘my_section’, ‘capability’ => ‘edit_theme_options’, ‘sanitize_callback’ => ‘sanitize_my_setting’ )); $wp_customize->add_control(‘my_control’, array( ‘label’ => ‘My option’, ‘section’ => ‘my_section’, … Read more

Return customizer setting value in functions.php

The solution was to get the customizer value inside the function, not passing the value to the function. function hn_add_inline_css() { $breakpoint = get_theme_mod( ‘setting_navigation-breakpoint’, ‘768’ ); $custom_css=” @media (min-width: ” . $breakpoint . ‘px) { .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } …

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)