Wordpress Archives | Codeexecute

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 );

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 

if ( have_posts() ) : the_post();

// get custom value of the post

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

// get post thumbnail 

<?php the_post_thumbnail(); ?>

// get thumbnail url

$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)
  $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(); ?>