Hide Heading if ACF Field is empty

Move the outer(of the two) div.local_faq inside the if statement which checks if the faq field is set, because that’s the outer parent container. Also it would make sense to change the outer container div to have a plural div.local_faqsclass instead of the same class as the nested div.local_faq Then just add the h3 part … Read more

How to allow certain PHP functions when using sanitize_callback in the word press customizer

This sort of theme mod is only capable of conveying a string into the markup regardless of any sanitization callback – any PHP included within the string will never be interpreted by the PHP engine, short of running the output through eval() which would be extremely dangerous and likely result in the theme failing review … Read more

Can I make a Customizer dropdown-pages list include private pages?

Unfortunately there doesn’t seem any way to hook into the underlying get_pages call that the control dropdown-pages uses, so you’ll have to build your own set of choices (that includes private pages) and use the standard select control type instead: if ( ! class_exists( ‘WPSE_406789_Walker_Page_Options’ ) ) { class WPSE_406789_Walker_Page_Options extends Walker_Page { public $choices … Read more

WordPress get_media_embedded

Because print_r prints a readable version of your variable $media, which will be an array as per the documentation for get_media_embedded_in_content(). You see Array ( [0] => [youtube embed] ) in your browser because it’s rendering the HTML of the array element – if you check the source code of your page you would see … Read more

Thesis -style Navigation

This is how I do it in a custom theme: <h3>Select pages to include in menu:</h3> <p> <?php $page_ids = get_all_page_ids(); $current_selected = get_option(“pages_to_include”); foreach( $page_ids as $page_id ) { if( get_post_status( $page_id ) == ‘publish’ ) { $checked = ( !empty( $current_selected ) && in_array( $page_id, $current_selected ) ) ? ‘ checked=”checked”‘ : ”; … Read more

Add filter on html tags,attributes on specific function in wordpress

Use a custom pagination function: my source: function fb_paging_bar( $args = array() ) { $defaults = array( ‘range’ => 4, ‘custom_query’ => FALSE, ‘previous_string’ => __( ‘&laquo;&laquo;&laquo;’, FB_GREYFOTO_TEXTDOMAIN ), ‘next_string’ => __( ‘&raquo;&raquo;&raquo;’, FB_GREYFOTO_TEXTDOMAIN ), ‘view_fp’ => TRUE, ‘view_lp’ => TRUE, ‘before_output’ => ‘<div class=”postlink”>’, ‘after_output’ => ‘</div>’ ); $args = wp_parse_args( $args, apply_filters( ‘fb_paging_bar_defaults’, … Read more