4

You can remove the current icon by css and then you can add your new icon in the .menu-toggle button with background-image. the css is below; .genericon-menu:before{ content: " "; } .main-navigation .menu-toggle{ background-image: url(/*image url*/); background-size: contain; }


4

This is an old question, but I thought I'd share in case it helps someone else. Notices are added by the following actions (in this order): network_admin_notices (for network admin--aka super admin. You don't want to remove these.) user_admin_notices (for site admin) admin_notices (for other users) The last action to be run before these is in_admin_header ...


3

Are you using wp multisite? If yes, you can add themes and plugins only from multisite dashboard, and not from site dashboard


3

The inspector says "inline" which indicates that the CSS is not in a separate file, but instead is inside the HTML itself, probably in a <style> block at line 39 ( near the top ) - search the whole page source code for #masthead and you will probably find it. If you want to know how it is being added to the theme HTML, you will need to search ...


3

If you're going to be deferring more than one stylesheet, I've found this approach to be fairly reusable. Put this somewhere: function _changeme_defer_css( $html, $handle ) { $deferred_stylesheets = apply_filters( 'changeme_deferred_stylesheets', array() ); if ( in_array( $handle, $deferred_stylesheets, true ) ) { return str_replace( '...


3

Firstly, I would ensure that your child theme is well equipped with hooks to accommodate the potential customizations. Secondly, I'd create a site-specific plugin - specific, that is, to the site to be customized - which takes advantage of the theme's hooks to make the required changes. This will be immune to theme updates and will correctly integrate into ...


2

This is for Algerian wilayas & communes, for the full code check this repo: https://github.com/ilyesrd/Insert-Wilayas-Communes-to-custom-taxonomy-in-wordpress add_action('init', 'add_wilayas_and_communes', 100); function add_wilayas_and_communes() { $communes = array( // Take a look to this repo: https://github.com/ilyesrd/Insert-Wilayas-...


2

In case if you need to edit the block_formats dropdown, you can do this in that way: add_filter('tiny_mce_before_init', function($init_array) { $block_formats = [ 'Paragraph=p', 'Heading 1=h1', 'Heading 2=h2', 'Heading 3=h3', ]; $init_array['block_formats'] = implode(';', $block_formats); return $init_array; })...


2

Here's an (untested) example on how to get the saved post's categories, check if any of them exists in another taxonomy, and terms that exists to the post. Instead of the generic save_post action you can use the post type specific one, save_post_{post_type}. If you want to prevent the check from running every time the post is saved / updated, you can utilize ...


2

It's just a form that takes a GET parameter named s. Example: <form method="get" action="/"> <input type="text" name="s" placeholder="type here to search"> </form> But I recommend using the function called get_search_form() that does basically the same thing.


2

Lookup wp_nav_menu Simply take the HTML you have now and remove the <ul> or whatever elements you are using to list the menu links. If you want it to be dynamic, your theme template will need something similar to the following placed where you want the links to load in place of what you had in your regular HTML site: <?php wp_nav_menu(array( ...


1

As of WordPress version 5.6, any posts or pages has options on the editor to include any custom scripts/styles and meta tags to the header of the page. So if you put your <link rel"icon" href="favicon.png"/> it should work. You upload your favicon into the media and after you uploaded the media. Refer the uploaded favicon png image ...


1

Just saw it... ...in your HTML, take the action out entirely. We're not using the HTML to tell the form/submit button what to do, we're using JS/AJAX for that. <form method="POST" action="<?php echo admin_url('admin-ajax.php'); ?>" id="modal-form-ajax" autocomplete="off"> Should become: <form method=&...


1

The best way is to use .htaccess file to block all requests by adding # Block WordPress xmlrpc.php requests <Files xmlrpc.php> order deny,allow deny from all allow from 1.1.1.1 </Files> to the end of the file but if you want the easiest way using Disable XML-RPC-API plugin will do the job.


1

9 years and a pandemic later, I found my way to do use the filter of @mrwweb and create a nicely working Bootstrap (4) collapse with the Wordpress widgets: Because the dynamic_sidebar_params do contain unique params (such as ID) you can use this to add a custom collapse ID to each widget created. See: https://developer.wordpress.org/reference/hooks/...


1

The UI you want is the default browser UI for an <audio> tag, specifically Google Chrome. That tag gets swapped out for a JS based audio player control once the DOM has finished loading. The dark player is the JS based audio player. The light UI you prefer is the browsers default UI. This means, that the UI you want is only available if the user has ...


1

With the help of Q Studio and my own research, I found that exploding with PHP_EOL worked. Here is my modified code: function eriWpConfig(){ $wp_config = FALSE; if ( is_readable( ABSPATH . 'wp-config.php' ) ) $wp_config = ABSPATH . 'wp-config.php'; elseif ( is_readable( dirname( ABSPATH ) . '/wp-config.php' ) ) $wp_config = ...


1

since you are using a block editor, you should be able to select the text, and then set the color.


1

You don't, if you need a dynamic value you have to have a server rendered block. Otherwise, if you managed to get the theme mod, it would be frozen to the value it had at save, and changing the value in the customiser would not update the blocks. So use a dynamic server rendered block and grab the value in PHP the same way you normally would.


1

get_the_title() returns the post (product) title including all HTML, whitespaces and symbols not allowed in URLs, etc. Use post slug instead. Also, you don't need to use any actions. function custom_hero_image( $post_id ) { $product = get_post( $post_id ); $slug = $product->post_name; if ( is_product( $post_id ) ) { $html = '<...


1

I think you might be looking for something like this: add_theme_support( 'custom-logo', array( 'height' => 480, 'width' => 720, ) ); You could also go with: add_theme_support( 'custom-header', array( 'height' => 480, 'width' => 720, ) ); Use the custom-header for the top logo and the custom-logo for the footer (or the other ...


1

CF7 has an useful hook wpcf7_submit that can be used to process the data sent: add_action("wpcf7_submit", "SE_379325_forward_cf7", 10, 2); function SE_379325_forward_cf7($form, $result) { if( !class_exists('WPCF7_Submission') ) return; $submission = WPCF7_Submission::get_instance(); if ($result["status"] == "...


1

You can use the custom fields included in wordpress Add a new post and do the following steps: 1. Go to the Options page 2. Select "custom fields" and hit the reload button 3. you now have a custom field in your post edit page at the bottom. now you can use this custom field in your theme inside the post-loop <?php while ( have_posts() ) : ...


1

where to use the post_class() You can use it pretty much everywhere (in WordPress), e.g. single post pages (single.php, single-my_cpt.php, etc.), search results pages (search.php), the index template (index.php), a template part (e.g. content.php), and a shortcode function. it is ok to use post_class() for adding custom classes? Yes, it is. post_class() ...


1

Here is the code based on custom SQL query as suggested by @Rup that should work for you: // get '-1 month' and '+2 month' dates as an array('YYYY', 'MMDD') $before = str_split( gmdate( 'Ymd', strtotime( '-1 month' ) ), 4 ); $after = str_split( gmdate( 'Ymd', strtotime( '+2 month' ) ), 4 ); // if the before/after years are the same, should search for date &...


1

add_action( 'customize_register', 'theme_customize_register' ); /** * Register individual settings through customizer's API. * * @param WP_Customize_Manager $wp_customize Customizer reference. */ function theme_customize_register( $wp_customize ) { // You can first start by adding a section $wp_customize->add_section( '...


1

That's not how you create tables with dbDelta. dbDelta expects an SQL statement as its argument, but the code in your question passes none. What's more, the SQL is passed into wpdb->query, and has no checks or sanitisation. A quick run of PHPCS would reveal warnings that no prepare call is used. Instead, the official documentation at https://developer....


1

{type}_template is a filter inside the get_query_template function. That function is called by a series of functions called get_home_template, get_category_template and so on. It allows you to very specifically target templates. You can see it in action in template-loader.php, where the $tag_templates variable is defined, binding conditions like is_home, ...


1

I have noticed that the code our friend shares has an error. Add the prefix twice. I share other code with this error resolved. <?php add_filter( 'pre_user_login', 'sneakily_add_prefix_to_username' ); function sneakily_add_prefix_to_username( $username ) { if ( ! current_user_can( 'manage_network' ) ) { $blog_id = get_current_blog_id(); ...


1

Yes, you can filter and modify any 3rd party plugin's shortcode attributes and change the shortcode output according the updated shortcodes Case Study For example we have an 3rd party plugin's shortcode usermeta and its required a attribute user_id and we want to modify the user_id attribute value. The following solution is tested and working 100%. // hook ...


Only top voted, non community-wiki answers of a minimum length are eligible