How can i add simple code in only in posts by function.php

You can perform simple check to make sure, the post type is post; before executing actual code. For example: add_action(‘wp_head’, ‘load_custom_style_for_posts’); function load_custom_style_for_posts(){ global $post_type; if( ‘post’ == $post_type ){ echo “<style>blahblah</style>”; } }; Place this code inside functions.php Hope it helps! 🙂

Assign all Post in Wp to a specific Category

Find out the ID of the category that you want to assign. You’ll see it in the URL when editing the category (URL will be something like ?taxonomy=category&tag_ID=3&post_type=post, here 3 is the ID) Assuming that the ID is 3, you can now run this query in your database (eg via PHPMyAdmin) INSERT IGNORE INTO wp_term_relationships … Read more

Change the layout of action links under the plugin names

you can customise these links with this filter : https://developer.wordpress.org/reference/hooks/plugin_action_links_plugin_file/ try that : const PLUGIN_SLUG = “super-socializer/super_socializer.php”; add_filter(“plugin_action_links_” . PLUGIN_SLUG, function (array $actions, string $plugin_file, array $plugin_data, string $context) { unset($actions[1]); // remove link “Add-Ons” unset($actions[2]); // remove link “Support Documentation” return $actions; }, 10, 4);

Moving FB comments at the end of page

From the plugin’s user manual. Curent_url – Type the page URL from where you need to show Facebook comments So you will have to change the current URL which is (http://developers.facebook.com/docs/plugins/comments/) to your real current URL. global $wp; $current_url = home_url( add_query_arg( array(), $wp->request ) ); echo do_shortcode(‘[wpdevart_facebook_comment facebook_app_id=”12345678910111213″ curent_url=”‘.$current_url.’ ” order_type=”social” title_text=”Facebook Comment” title_text_color=”#000000″ … Read more

add seperate suffix for low price and high price in woocommerce

You cloud use the filter “woocommerce_format_price_range” from the “wc_format_price_range” function to modifed the price. A small example: function my_function_to_change_the_price_formating($price) { // If you look in the function wc_format_price_range, you will see that the two prices are separated by a dash. (&ndash;) // We used this “dash” and separate the two prices. $tmp = explode(‘&ndash;’, $price); … Read more

Delete free version plugin will also delete premium plugin

WordPress remembers plugins by folder_name/main_plugin_file_name. So please make sure that both free and premium plugins folder names are not the same. Check it. If the names are different, it should not delete both plugins on deleting one. If your problem persists even when the folder names are different, then there must be some code which … Read more

Notice: Undefined index: mtral_field_subscriber

You can simply remove that plugin, and create that redirection youself. You can use the login_redirect hook, add this into your theme’s functions.php function redirect_admin( $redirect_to, $request, $user ){ //is there a user to check? if ( isset( $user->roles ) && is_array( $user->roles ) ) { //check for admins if ( in_array( ‘administrator’, $user->roles ) … Read more