WordPress on localhost working, when sharing IP to connect receive err_connection_refused on .js and .css files

As discussed in comments, the problem was that the site address was set to localhost:8888/myBlog. This is the URL WordPress is expecting your clients to be using, and uses this to generate fully-qualified URLs for scripts and CSS etc. Hence your other clients were trying to load scripts and CSS from their own localhost. The … Read more

How to change the style.css?ver=5.4.1 in WordPress?

When you enqueue the style, you can use filemtime() as the version: <?php add_action(‘wp_enqueue_scripts’, ‘wpse_367594_enqueue_version’); function wpse_367594_enqueue_version() { wp_enqueue_style( // Update this to your slug. ‘style-slug’, // Update to your stylesheet URL if it’s not the main style.css. get_stylesheet_directory_uri() . ‘/style.css’, // Include dependencies here or pass an empty array. array(‘theme-dependency’), // Here’s the line … Read more

Use wp_add_inline_style to add code to before wp_head?

Yes, that should be doable. Just enqueue your inline styles with callback hooked to wp_enqueue_scripts and priority set to 0 (assuming other styles are loader later / lower priority / bigger number). You also need to register a dummy handle to which you attach the inline styles to, so no other styles are loaded before … Read more

How can I upload an image for background use using the Theme Editor in WordPress?

Giving the CSS of background #FFFFFF url(‘images/newbackground.gif’); is just giving an example based on basic CSS. Be careful when copying the suggestions made in the book because you missed an important colon after background. It should be background: #FFFFFF url(‘images/newbackground.gif’); Also, you need to make sure the URL part of the CSS is correct for … Read more

How Display Posts on category

You should look at the WordPress Template Hierarchy. If you want to show an archive of your posts you create a template called archive-mahsulat.php where mahsulat is your post type. Then you can add a normal WordPress Loop to the file so it can output posts of that type. If you’re looking to create a … Read more

Media library style not loading correctly when selecting a page featured image?

After some search, the problem was in the pages which contains ACF blocks ACF plugin is not compatible with the latest WP 5.9.1 temporary fixes until the update has been released : 1- In your functions.php file add these lines: function acf_fix_preload_path( $preload_paths ) { global $post; $rest_path = rest_get_route_for_post( $post ); $remove_path = add_query_arg( … Read more

How do I modify the position of a plugin?

It’s always bad practise to modify a plugin file. For one thing you will lose your changes when the plugin is updated. Look to see if your plugin has been created with filters (good plugins should be). Search within your plugin for “apply_filters(” – With luck you will find this near the positional code. It … Read more

Missing sidebar parameter “fix” – before_content

This code detects whether a title has been set, and if not, it changes the before_widget argument. add_filter( ‘widget_display_callback’, ‘wpse4213_widget_display_callback’, 10, 3 ); function wpse4213_widget_display_callback( $instance, $widget, $args ) { if ( empty( $instance[‘title’] ) ) { $args[‘before_widget’] = ‘<div class=”container”><div class=”content”>’; $widget->widget( $args, $instance ); return false; } return $instance; } This code works … Read more