Stylesheet version not showing in browser when adding version number to stylesheet in enqueue

It appears you’re using the Sage theme framework – presumably you’re also using Soil? One of Soil’s modules explicitly disables asset versioning – ensure that you haven’t enabled in it in your theme by way of add_theme_support( ‘soil-disable-asset-versioning’ ); or add_theme_support( ‘soil’, [ ‘disable-asset-versioning’ ] ); If Soil is not responsible it could be any … Read more

How could i open two url with one hyperlink click [closed]

<a href=”#” onclick=”window.open(‘http://google.com’); window.open(‘http://yahoo.com’);”>Click to open Google and Yahoo</a> Please note this will not work if pop-up are disabled – the most you will get is one window. For testing disale your popup blocker in your browser. Note that site visitors who have popups enabled will not see both urls open.

How to get parameters with add_filter with a static method?

First, consult the documentation or source code to see how many arguments are passed to the filter. We can see it has 3 in total, and the comments object is the second one, so you’ll need to have at least two. Next, you’ll want to declare the number of arguments to pass to the function … Read more

Custom Admin Post Column change order

Thanks to @cameronjonesweb’s link, here’s the code you might use: add_filter( ‘manage_edit-post_sortable_columns’, ‘my_add_sortable_custom_column’); function my_add_sortable_custom_column( $columns ) { $columns[‘views’] = ‘views’; return $columns; } add_action( ‘pre_get_posts’, ‘my_sort_custom_column’ ); function my_sort_custom_column( $query ) { if( ! is_admin() || ! $query->is_main_query() ) { return; } if ( ‘views’ === $query->get( ‘orderby’) ) { $query->set( ‘orderby’, ‘meta_value’ ); … Read more

Develop theme with demo default content, programmatically create pages

use after_setup_theme create your post and tags then save the data, add option key and only run your setup once, i.e. add_action( ‘after_setup_theme’, function() { $setupKey = ‘my_theme_activated’; $setupAlreadyRun = get_option($setupKey); if ( $setupAlreadyRun ) return; my_theme_setup( $setupKey ); }); function my_theme_setup( $setupKey ) { $posts = [ [ ‘post_title’ => ‘Project Page’, ‘post_type’ => … Read more

the_author function is displaying wrong name and url

Sorry, but I found the answer very quickly myself and I attempted to delete this original question, but I think maybe somebody else may need this answer. This is right code to solve this issue: <h1 class=”page-title”> <?php echo ‘<a href=”‘.get_author_posts_url(get_userdata($posts[0]->post_author)->data->ID).'”>’.get_userdata($posts[0]->post_author)->data->display_name.'</a>’; ?></h1>

Add Filename Colum to Media Library

Found the solution: I just changed “name” to “Filename” on this function: // Register the column as sortable & sort by name function filename_column_sortable( $cols ) { $cols[“filename”] = “Filename”; return $cols; }

How to detect if an ACF custom-field is really in use?

Most sensible here is probably just a custom query global $wpdb; $sql_find_meta = “SELECT post_id FROM database_name_here.wp_postmeta WHERE meta_key = ‘my_special_value’ AND meta_value > ”;”; // > ” == not null, whitespace or blank $posts_with_meta_key = $wpdb->get_col( $sql_find_meta ); foreach ( $posts_with_meta_key as etc….. You can repeat this for wp_termmeta and term_id