How to get woocommerce page urls

Shop Url

$aUrl = get_permalink( woocommerce_get_page_id( 'shop' ) );

Cart Url

global $woocommerce;
$aUrl = $woocommerce->cart->get_cart_url();

Checkout Url

global $woocommerce;
$aUrl = $woocommerce->cart->get_checkout_url();

Account Url

$aAccountPageId = get_option( 'woocommerce_myaccount_page_id' );
$aUrl = get_permalink( $aAccountPageId );
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

How to create wordpress theme woocommerce supportable

(1) Add following code in functions.php file

function your-theme-name_setup() {
   add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'your-theme-name_setup' );

(2)Create a folder “woocommerce” in your theme
(3)Copy template file from “wp-content\plugins\woocommerce\templates” and paste into “wp-content\themes\your-theme-name\woocommerce”

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

WordPress Content Functions

These are the pre-define function defined in wordpress we just need to use 
it directly where we wanted.
the most common functions we normally use is get title , get site url etc.
So basically  these are for beginners  and you become expert while regular using this.
there are comment with every function to explain its functionality. 


// title of the post


<?php the_title(); ?>


// web site url 


<?php echo site_url(); ?>


// web site name 


<?php echo get_bloginfo(); ?>

// post body 

<?php 
if ( have_posts() ) : the_post();
the_content();
endif;
?> 


// get custom value of the post


<?php 
$cusomVal = get_post_custom_values('name_of_custom_value', $post->ID);
echo $cusomVal[0] ;
?>


// get post thumbnail 

<?php the_post_thumbnail(); ?>


// get thumbnail url

<?php  
$post_thumbnail_id = get_post_thumbnail_id($post->ID);
$post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
?> 


// post per page attributes (give the required number of post on the page)
<?php
  $args = array( 'posts_per_page' => 5, 'offset'=> 0 );
  $myposts = get_posts( $args );
?>

// limited post text on the page (put this on the place the_content())and add ellipse in the end


<?php the_excerpt(); ?>


// get published date 
<?php echo get_the_date(); ?>

</pre>
<pre>
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  
Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.