Category: Wordpress Tips

How to get top parent page ID in wordpress 0

How to get top parent page ID in wordpress

The solution to get the top parent page id is here, it is quite easy without using any recursion function. function get_top_parent_page_id() { global $post; // Check if page is a child page (any...

Add/Remove unwanted links from wordpress admin bar 0

Add/Remove unwanted links from wordpress admin bar

Remove links from wordpress admin bar: Given below code remove the wordpress logo and other links from the admin bar. function annointed_admin_bar_remove() { global $wp_admin_bar; /* Remove their stuff */ $wp_admin_bar->remove_menu(‘wp-logo’); $wp_admin_bar->remove_menu(‘updates’); $wp_admin_bar->remove_menu(‘view-site’); $wp_admin_bar->remove_menu(‘new-link’);...

Remove unwanted menu/submenu links from wordpress dashboard 0

Remove unwanted menu/submenu links from wordpress dashboard

Remove menu page links: function remove_menus() { global $submenu; remove_menu_page( ‘link-manager.php’ ); // Links remove_menu_page( ‘edit-comments.php’ ); // Comments remove_menu_page( ‘themes.php’ ); // Appearance remove_menu_page( ‘plugins.php’ ); // Plugins remove_menu_page( ‘users.php’ ); // Users...

Get customize categories in wordpress 0

Get customize categories in wordpress

The following example will show the categories with checkbox <?php $args=array( ‘child_of’ => ‘1’, ‘hide_empty’ => ‘0’ ); $categories = get_categories($args); foreach($categories as $key => $value){ ?> <label><input name=”escorts_category[]” value=”<?php echo $categories[$key]->cat_ID; ?>” type=”checkbox”>...

Add Custom Post Type Counts to the Dashboard 0

Add Custom Post Type Counts to the Dashboard

we have several ways to add custom post type counts to the dashboard including right_now_content_table_end. For Example: function add_area_counts() { if (!post_type_exists(‘escorts’)) { return; } $num_posts = wp_count_posts( ‘escorts’ ); $num = number_format_i18n( $num_posts->publish...

Change wordpress excerpt length 0

Change wordpress excerpt length

Copy and paste the given blow code in your theme functions.php file which will change the length of the wordpress excerpt function. function ratanjyot_solutions_excerpt_length($length) { return 50; } add_filter(‘excerpt_length’, ‘ratanjyot_solutions_excerpt_length’); The above code set...