Add the title of a widget as an ID – for anchor links

Yes you can add an around the title of the widget, you do this in the register_sidebar code which you would put in your functions.php add_action( ‘widgets_init’, ‘theme_register_sidebars’ ); function theme_register_sidebars() { register_sidebar( array( ‘id’ => ‘mysidebar-sidebar’, ‘name’ => __( ‘My Sidebar’, ‘themename’ ), ‘description’ => __( ‘Widgets for my sidebar’, ‘themename’ ), ‘before_widget’ => … Read more

Sort results by name & asc order on homepage

Since you only want to hook into the posts on your homepage, I think you only need something like this: <?php add_action( ‘pre_get_posts’, ‘my_change_sort_order’); function my_change_sort_order( $query ){ if ( ! is_admin() && $query->is_main_query() ) : if ( is_front_page() ) : //Set the order ASC or DESC $query->set( ‘order’, ‘ASC’ ); //Set the orderby $query->set( … Read more

Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?

WordPress recommends the proper way to enqueue the main style is the method-A. Please see the WordPress theme development handbook here (though both methods will work). https://developer.wordpress.org/themes/basics/including-css-javascript/ It’s not clear to me why you want to link the two .css file? You can create custom .css file and enqueue it using method-B. However, if you … Read more

Two ‘If Statements’ is my syntax correct (functions.php) and what is ‘false’

You should use elseif for the second if statement: $title1 = single_term_title( ‘Conferences In&nbsp;’, false ); $title2 = single_term_title( ‘CConferences In&nbsp;’, false ); add_filter( ‘get_the_archive_title’, ‘my_theme_archive_title’ ); function my_theme_archive_title( $title ) { if ( is_tax(‘us_state’) ) { $title1; } elseif ( is_tax(‘country’) ) { $title2; } else { return $title; } } You can read … Read more

WPDB function not saving

It could also be the result of this known bug: https://core.trac.wordpress.org/ticket/32315 If your data is larger than the varchar field length then $wpdb->insert will fail and produce no errors. If you don’t mind data being truncated if it’s larger than the field length, switch to $wpdb->query($wpdb->prepare(..)). Because of this stupid bug I haven’t used insert … Read more

site_url is not honoring scheme

What is original link? var_dump( get_option(‘siteurl’) ); If I am interpreting code right then for http protocol argument action is to not change the link. So if you have set up URL to be secure by default then function doesn’t override that.