How to add a title attribute to WordPress posts links
If you’re encountering issues adding a title attribute to WordPress post links, follow these steps: In the post loop or within your custom HTML, you can use the title attribute along with the anchor () tag to ensure it is added properly.
How to include styles and scripts on wordpress admin pages?
How do I add CSS and JavaScript to WordPress admin area? In “admin_enqueue_scripts” hook used to include scripts and css in admin area add_action(‘admin_enqueue_scripts’, function() { wp_enqueue_style( ‘myscript’, PTS_CSS_URL.’/myscript.css’); });
Page Template dropdown missing from page attribute in wordpress
Page Template dropdown missing from page attribute in wordpress: Either you are are added any page template or format is not correct while adding page template name It is because of space after the page template name: wrong code : <?php /* Template Name :Contact page // No need to add space here */…
How to add a logo uploading field in customize settings in wordpress
How to add a logo uploading field in theme customize settings in wordpress While creating our own theme, we need to add a logo adding field in in customize settings of theme (under appearance). add_action( ‘customize_register‘, ‘themecustomizer’ ); function themecustomizer( $wp_customize ) { $wp_customize->add_section( ‘theme_logo’ , array( ‘title’ => __( ‘Logo’, ‘theme’ ), ‘priority’ =>…
How to add a new page in wordpress admin
In functions.php file, Add following code add_action( ‘admin_menu’, ‘mycustompagemenu’ ); function mycustompagemenu(){ add_menu_page( __( ‘My own Settings’, ‘textdomain’ ), ‘my theme settings’, ‘customize’, ‘mythemesettings’, ‘my_theme_settings_fun’, get_template_directory_uri().’/images/icon.png’, 60 ); } function my_theme_settings_fun(){ esc_html_e( ‘Admin Page’, ‘textdomain’ ); } For more details add_menu_page()
Template is missing. Standalone themes need to have a index.php template file. Child themes need to have a Template header in the style.css stylesheet.
In WordPress themes showing error like : Broken Theme as below : Template is missing. Standalone themes need to have a index.php template file. Child themes need to have a Template header in the style.css stylesheet. This is because of your child theme missing, Template Name is missing from the style.css Add this line…
Display coupons used in an order in woocommerce
Use any order hooks. here we get the deatils of coupen once cancelled the order from orders list add_action(‘woocommerce_order_status_cancelled’, ‘order_cancelled_woo’); order_cancelled_woo($order_id){ $order = new WC_Order($order_id); $coupens= $order->get_used_coupons(); file_put_contents(‘filename1.txt’,print_r($coupens,true)); }
Ajax return 0 in wordpress
Use echo instead of return a value from ajax function . { echo ‘locked’; die(); }
How to add a new user meta field for all users in wordpress
$users = get_users(); foreach( $users as $user ) { $uid=$user->ID; add_user_meta($uid, ‘newfield’,’0′); } }
Adding a meta data once a new user is created in wordpress?
Add Custom User Meta During Registration in WordPress add_action( ‘user_register’, ‘bonus_point_for_new_user’); function bonus_point_for_new_user( $user_id ) { add_user_meta($user_id, ‘newfield’,’0′); }