Get the current post parent category ID
How to get the current post parent category ID? Just copy the codes below and paste this your template.
global $post; $category = get_the_category( get_the_ID() ); $parent = $category[0]->term_id
<ul> <li>AAA</li> <li>AAA</li> <li>AAA</li> <li>AAA</li> </ul> var ul_width = 0; jQuery( 'ul li' ).each(function(index, element) { ul_width += jQuery( this ).innerWidth; }); jQuery( 'ul' ).css('width', jQuery( this ).width(ul_width) });
The7 pagination in custom WP_Query, just copy the code below and paste it in your functions.php. dt_paginator( $query, array( 'class' => 'paginator no-ajax', 'ajaxing' => false ) ); [php] Example: [php] $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $args = array( 'cat' => '8', 'posts_per_page' => 8, 'paged' => $paged ); $query =…
Hello guys, have you experience this issue on your current theme? WooCommerce archive, and single product pages does not displaying the default layout? Details show in one paragraph instead of grid? That means your current theme does not support Woocommerce and that’s what were going to do now. Just add the codes below and your…
How to get the current scroll top position? Copy and past the following codes below to your JS file. var current_scroll = window.scrollY; console.log( current_scroll );
Check the links below for references to answer the question “How to redirect WordPress login/logout to custom page?” Use this https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect for login redirect. Use this https://codex.wordpress.org/Plugin_API/Filter_Reference/logout_url for logout redirect.
How to display post edit links after content? Copy and paste the codes into your page template echo '<p class="alignright"><a class="button" href="' . get_edit_post_link( get_the_ID() ) . '">Edit Post</a></p>';