WordPress codex for page
How to get the current page slug?
global $post; $slug = get_post( $post )->post_name;
For example I want to add a ” Home Slider ” post type. Below is the perfect codes. Just copy and paste it into your functions.php add_action( 'init', 'home_slider_post_type' ); function home_slider_post_type() { $labels = array( 'name' => _x( 'Home slider' ), 'singular_name' => _x( 'Home Slider' ), 'menu_name' => _x( 'Home Slider' ), 'name_admin_bar'…
Disable ui tabs menu $("#tabs").tabs("option","disabled", [0, 1]); // Option 1 $( "#tabs" ).tabs( "disable", "#tabs-2" ); // Option 2 $( '#tabs li.disabled-tab' ).addClass( 'ui-state-disabled' ); // Option 3
How to control the post displayed on a specific category? You can solve this problem by simply copy the codes below on your functions.php file. function category_blog_posts_per_page( $query ) { if ( is_admin() || ! $query->is_main_query() ){ return; } if( is_category( 1 ) ){ $query->set( 'posts_per_page', 15 ); } } add_action( 'pre_get_posts', 'category_blog_posts_per_page', 1 );
[round-to-the-nearest-number]
Here’s how The7 WordPress themes page layout change via filter functions. How to manage your page/post layout? Remove sidebar or sidebar in left or right? We can use filter function to do the task. This is mostly used in custom post type pages. Original code snippets of The7 WordPress themes inc/helpers/html-helpers.php function presscore_main_container_classes( $custom_class =…
Having problem on The7 WordPress theme share buttons on single post or custom post type? You can display a share buttons anywhere using this codes below. Mostly needed in custom post type that does not support this feature. $share_buttons = presscore_display_share_buttons_for_post( 'post', array('echo' => false)); if ( $share_buttons ) { printf( '<div class="post-meta wf-mobile-collapsed">%s</div>', $post_tags…