Posts

Showing posts with the label wordpress

Resolved - wordpress pagination adds extra slashes to url in post or category

I am working on blog where pagination is not working correct. All is working but when I click to the next page the url will get a extra slash in the URL, not sure why this is happening but when using the pagination a lot will add every time a new slash to the URL. URL Links are like this: mysite.com/blog/ , mysite.com/blog//page/2, mysite.com/blog///page/3, mysite.com/blog////page/4 You are using this code probably: ===============================  $total_pages = $loop->max_num_pages;     if ($total_pages > 1){         $current_page = max(1, get_query_var('paged'));         echo paginate_links(array(             'base' => get_pagenum_link(1) . '%_%',             'format' => '/page/%#%',             'current' => $current_page,             'total' => $total_pages,             'prev_text'    => __('« prev'),             'next_text'    => __('next »'),         ));     }    } ====

How to show product catalog in woocommerce based on date descending order?

You can show product catalog in woocommerce based on date descending order. For showing the product based on date descending order or asc order you have to use a filter in your child theme or current theme. Open funcation.php in your theme. You can find funcation.php in the root of your theme. Update this code and this code will replace the soft order of product to based on date descending order. -------------------- add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');   function custom_default_catalog_orderby( $sort_by ) {     return 'date desc'; }

How to Show taxonomies terms on front as colorized or color circle checkboxes in woocommerce woocommerce-products-filter plugin?

Image
You can Show taxonomies terms on front as colorized or color circle checkboxes in woocommerce woocommerce-products-filter plugin? How to show circle instead of name of color in woocommerce woocommerce-products-filter plugin. If you want show color attributes color in circle you in woocommerce-products-filter plugin. You do not need buy an extension. Just do what i say: Open this folder wp-content/plugins/woocommerce-products-filter/views/html_types Open this file from above folder checkbox.php Go to line no 111 and 226. replace this line: echo $term['name']; TO           if($term['taxonomy']=='pa_color'){                             $ars = get_term_meta($term['term_id']);                             $colorp = $ars['color_value'][0];                             ?>                             <style type="text/css">                                 .pcirclecolor {                                     height: 30px;                  

Themify WooCommerce Product Filter shows category disabled if we redirect a page then we choose another category we can not back to previous category.

Themify WooCommerce Product Filter shows category disabled if we redirect a page then we choose another category we can not back to previous category. To solve this problem. go to: /themify-wc-product-filter/includes/class-wpf-form.php Go to line no. 1111 Then replace this line $read_only = 'readonly'; to $read_only = ''; Themify WooCommerce Product Filter - now to enable the filter radio button when a category chooses.

is_home() and is_front_page() not working in wordpress?

I want to same content on home page but is_home() and is_front_page() not working in wordpress. Why? Then i search some sites and find a solution. Here is the solution:- Just add this like right before of your condition <?php wp_reset_query(); ?> <?php if(!is_home()){         echo "home page"; <?php } else { echo "Not home page"; } Thanks

How to add One Page template in Twenty thirteen theme wordpress?

Add One Page template in Twenty thirteen theme wordpress. Here i will tell you that how to create one page template in twenty thirteen theme Step 1: create a folder inside theme folder themes/twentythirteen/ Like : themes/twentythirteen/ page-templates Step 2:  Create a file named one-page.php inside page-templates folder Step 3 : Copy and paste this code in your one-page.php page <?php /**  * Template Name: One Page  *  * Author Olivia Hoback  * www.olivia.nu  * @package WordPress  * @subpackage Twenty_Thirteen  * @since Twenty Thirteen 1.0  */ get_header(); ?> <div id="primary" class="content-area">         <div id="content" class="site-content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <div class="col-lg-12 inner">                     <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>                     <div cl

How to get top parent page ID in wordpress?

How to get top parent page ID in wordpress The solution to get the top parent page id is here, it is quite easy. function wp_get_top_parent_page_id() {     global $post;     // Check if page is a child page     if ($post->ancestors) {     //  Grab the ID of top-level page from the tree     return end($post->ancestors);     } else {     // Page is the top level, so use  it’s own id     //return $post->ID;     return 1;     }     } echo wp_get_top_parent_page_id();

How to get the post link in WordPress?

How to get the post link in WordPress? <?=get_permalink(12)?> Where 12 is the id of your post.

How to display post from a category in wordpress?

How to display post from a category in wordpress?  Simply copy and paste the code in your php file and change the category id which one you want to show. <h4>Latest Post</h4>           <ul class="list-blog">  <?php             query_posts(array('category__in' => array(4),'posts_per_page' => 4));             while(have_posts()) { the_post();             ?>             <li>             <?php             $post_thumbnail_id = get_post_thumbnail_id($post->ID);                        $post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );             if($post_thumbnail_url!='')             {                 $post_thumbnail_url = $post_thumbnail_url;             }else             {                 $post_thumbnail_url = get_template_directory_uri().'/img/noimg.jpg';             }             ?>              <img width="60" height="60" alt="" class="

How to open a menu links in new tab in WordPress?

Image
How to open a menu links in new tab in WordPress? In the menu tab, pull down the screen Option tab and select the Link Target attribute so you can add that. and checked Open link in new tab. WordPress

How to get home page link in WordPress when it is in subfolder?

How to get home page link in WordPress when it is in subfolder? Like localhost/WordPress/ Or www.site.com/WordPress/?p=1 <?php echo get_option('home'); ?> Try this :)

How to get the template Theme url in WordPress?

How to get the template Theme url in WordPress? <?php echo get_template_directory_uri(); ?>

How to Get category id for category.php page?

How to Get category id for category.php page? or How to Get category id for category page? <?php echo $cur_cat_id = get_cat_id( single_cat_title("",false) ); ?> Hope this will help you... :)

How to display in WordPress Category, Category post, Subcategory, Subcategory post?

Image
How to display in WordPress Category, Category post, Subcategory, Subcategory post? First you need to click on image and check how will result show on your page. And is this useful to you simple Copy and paste this code on your index page or where ever you want to show. Only you need to change the categories id in the array Hope this will help you <?php                             $row = 0; // Here you can pass the id of your category which you want to show                             $arrayid = array('0'=>9,'1'=>10,'2'=>7,'3'=>8,'4'=>11,'5'=>12);                             foreach($arrayid as $aid)                             {                             if($row%3==0){ ?> <div class="row-fluid"> <?php }                             ?>                                 <div class="span4 box-featured">                                     <div class=

How to get the page link in WordPress?

How to get the page link in WordPress? You can add simply this code to get page link only you have to pass the page id <?php echo get_page_link(30); ?>

How to get the category page link in WordPress?

How to get the category page link in WordPress? You can add simply this code to get category page link only you have to pass the category id <?php echo get_category_link($category->term_id);?>

How to add TimeStamp in wordpress like facebook and twitter?

How to add TimeStamp in wordpress like facebook and twitter? Simply copy and paste this code to use time stamp in wordpress you can also customize this time stamp code according to your need <?php $days = round((date('U') - get_the_time('U')) / (60*60*24)); if ($days==0) { echo "Posted today"; } elseif ($days==1) { echo "Posted yesterday"; } elseif ($days<8) { echo "Posted " . $days . " days ago"; } elseif($days<30) { $week = $days/7; echo "Posted " . round($week) . " weeks ago"; } else { $Month = $days/30; echo "Posted " . round($Month) . " months ago"; } ?>