How to get the current scroll top position?
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 );
add_filter( ‘the_content’, ‘hidden_image_before_content’ ); function hidden_image_before_content( $content ){ global $post; if ( is_singular(‘post’) && has_post_thumbnail() ){ $content = preg_replace( "/<p>/", ‘<p class="hide">’ . get_the_post_thumbnail($post->ID, ‘full’) . ‘</p><p>’, $content, 1 ); } return $content; }
Add sub-page using 1 page without adding another pages using add_rewrite_rule is very simple but clean strategy most specially if you have multiple sub-pages. Using add_rewrite_rule, your task is done. Please copy the codes to your functions.php. Example: I have this page, https://www.anthonypagaycarbon.com/parent/ and the page ID is 10. [php] add_filter(‘query_vars’, ‘wdes_query_vars’); function wdes_query_vars($vars) {…
Remove subcategory count. add_filter( ‘woocommerce_subcategory_count_html’, function(){ return ”; }); Change the number of loop shop columns. add_filter( ‘loop_shop_columns’, function(){ $cat_obj = get_queried_object(); $cat_id = $cat_obj->term_id; if( get_woocommerce_term_meta( $cat_id, ‘display_type’, true )== ‘subcategories’ ){ return 3; }else{ return 4; } }); Change the number of loop shop columns css. Just add a class on the body…
jQuery( document ).ready( function(){ var custom_timeout = ( function() { var timers = {}; return function ( callback, ms, uniqueId ) { if ( !uniqueId ) { uniqueId = "Don’t call this twice without a uniqueId"; } if ( timers[uniqueId] ) { clearTimeout ( timers[uniqueId] ); } timers[uniqueId] = setTimeout( callback, ms ); }; })();…
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>’;
For example I have ” /category/blog/ ” string and I want to convert it in an array. #String value $x = ‘/category/blog/’; #Convert to array $x2 = explode( ‘/’, $x ); #Output array Array ( [0] => [1] => category [2] => blog [3] => ) #Remove empty array $x3 = array_filter( $x2 ); #Output…