I can’t seem to install Font Awesome locally [closed]

Considering the folder structure “/public_html/wp-content/themes/TestTheme/static/fontawesome/” as folder location for Font Awesome use following instead 1 use following instead of the one you used for js include <script defer src=”https://wordpress.stackexchange.com/questions/299868/<?php echo get_template_directory_uri(); ?>/static/fontawesome/fontawesome-all.js”></script> 2 use following instead of the one you used for CSS include having fontawesome.min.css file in the CSS folder <link rel=”stylesheet” href=”https://wordpress.stackexchange.com/questions/299868/<?php echo … Read more

add_action template_redirect not working for home page

Be careful not to confuse the two query conditionals. Whether is_home() or is_front_page() return true or false depends on the values of certain option values. When using these query conditionals: If ‘posts’ == get_option( ‘show_on_front’ ): On the site front page: is_front_page() will return true is_home() will return true If assigned, WordPress ignores the pages … Read more

How to direct user after comment save

Use the filter comment_post_redirect: add_filter( ‘comment_post_redirect’, ‘comment_redirect’ ); function comment_redirect( $location ) { $location = ‘http://example.com/sample-page’; // or: // $location = get_page_link( page_ID ); // $location = get_page_link( get_page_by_path( ‘sample-page’ )->ID ) return $location; }

Is dynamic action name building a bad practice?

Usually yes, sometimes no, but in your example, definitely bad practice You see, instead of putting the name or the post ID in the action name, you should have passed it as a parameter instead. Otherwise there is no way to grab all elementor css file parsing, or no way to work after any arbitrary … Read more

woocommerce_new_product action doesn’t fire

Try like function add_this_to_new_products( $new_status, $old_status, $post ) { global $post; if ( $post->post_type !== ‘product’ ) return; if ( ‘publish’ !== $new_status or ‘publish’ === $old_status ) return; add_post_meta( $post->ID, ‘total_amount’, ‘0’, true ); // This is the action to take } add_action( ‘transition_post_status’, ‘add_this_to_new_products’, 10, 3 );

Change order of custom submenu link in WP Admin?

Take a look at this function. function my_submenu_order($menu_ord) { global $submenu; // echo ‘<pre>’.print_r($submenu,true).'</pre>’; $arr = array(); $arr[] = $submenu[‘users.php’][15]; // Your Profile $arr[] = $submenu[‘users.php’][10]; // Add New $arr[] = $submenu[‘users.php’][5]; // All Users $submenu[‘users.php’] = $arr; return $menu_ord; } add_filter(‘custom_menu_order’, ‘my_submenu_order’); Add that to your functions.php. It changes the default order of the … Read more

Create post revision on slug change

If you’re comfortable with PHP, it would be possible to keep track of when the slug is updated. The only way I can think of is a bit complicated: Make sure revisions are enabled, both for your install and for the post type you’re targeting. You’ll have to determine how many revisions you want to … Read more

WordPress ajax-action how to return content

OK, so you misunderstood it a little bit, I guess… You do the first part correctly. So yes – AJAX requests should be sent to wp-admin/admin-ajax.php and the should have action param set in the request (either as a POST or as a GET). But then, you do it wrong. You register your action with … Read more