Add Inline style using WordPress inbuilt functionality

add_action( 'init', 'prefix_register_styles' );

* Register Theme styles.
* @since 0.0
* @access public
* @return void
function prefix_register_styles(){

$themeversion = wp_get_theme()->display('Version'));

//Register main style.css for theme
wp_register_style( 'prefix-screen', get_bloginfo('stylesheet_url'), array(), floatval($themeversion) , false );


add_action( 'wp_enqueue_scripts', 'prefix_theme_stlyles' );

* Load Theme Styles
* @since 0.0
* @access public
* @return void
function prefix_theme_stlyles() {

if (is_admin()) {



if (!is_admin()) {

//Load the main style.css
wp_enqueue_style( 'prefix-screen' );

if( get_option('prefix-css-color', false) != false){

$color = get_option('prefix-css-color', false);

$prefix_themecss = ".blah{ background-color:$color;}";

wp_add_inline_style('prefix-screen', $prefix_themecss);




Get an attachments caption,title, alt and description

function wp_get_attachment( $attachment_id ) {
$attachment = get_post( $attachment_id );
return array(
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'caption' => $attachment->post_excerpt,
'description' => $attachment->post_content,
'href' => get_permalink( $attachment->ID ),
'src' => $attachment->guid,
'title' => $attachment->post_title

$attachment_meta = wp_get_attachment(your_attachment_id);

And then either loop through the array values or simply reference by the key name of what you want (ie: caption, description, etc.):

echo $attachment_meta['caption'];

The above would echo the image's caption.

Ajax Pagination example for woocommerce

Jquery code

jQuery(function($) {
$(document).on('click', '.pagi a', function(e){
var link = $(this).attr('href');
$('#content-all').fadeOut(500, function(){
$(this).load(link + ' #content-all', function() {

Content code


<div id=”content-all”>
<div class=”content-all”>
<?php do_action( ‘woocommerce_archive_description’ ); ?>
<div class=”nav-previous alignright pagi”><?php next_posts_link( ” ); ?></div>
<div class=”nav-next alignleft pagi”><?php previous_posts_link( ” ); ?></div>
<?php if ( have_posts() ) : ?>
* woocommerce_before_shop_loop hook
* @hooked woocommerce_result_count – 20
* @hooked woocommerce_catalog_ordering – 30
do_action( ‘woocommerce_before_shop_loop’ );
<?php woocommerce_product_loop_start(); ?>
<?php woocommerce_product_subcategories(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( ‘content’, ‘product’ ); ?>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
* woocommerce_after_shop_loop hook
* @hooked woocommerce_pagination – 10
do_action( ‘woocommerce_after_shop_loop’ );

<?php elseif ( ! woocommerce_product_subcategories( array( ‘before’ => woocommerce_product_loop_start( false ), ‘after’ => woocommerce_product_loop_end( false ) ) ) ) : ?>

<?php wc_get_template( ‘loop/no-products-found.php’ ); ?>

<?php endif; ?>

* woocommerce_after_main_content hook
* @hooked woocommerce_output_content_wrapper_end – 10 (outputs closing divs for the content)
do_action( ‘woocommerce_after_main_content’ );

Custom taxonomy for products


/* product Post Type

function product_taxonomy() {
‘product’, //post type name
‘hierarchical’ => true,
‘label’ => ‘Product Categories’, //Display name
‘query_var’ => true,
‘rewrite’ => array(
‘slug’ => ‘product’, // This controls the base slug that will display before each term
‘with_front’ => false // Don’t display the category base before
add_action( ‘init’, ‘product_taxonomy’);
function filter_post_type_link( $link, $post) {
if ( $post->post_type != ‘product’ )
return $link;

if ( $cats = get_the_terms( $post->ID, ‘product_categories’ ) )
$link = str_replace( ‘%product_categories%’, array_pop($cats)->slug, $link );
return $link;
add_filter(‘post_type_link’, ‘filter_post_type_link’, 10, 2);

//Registering Custom Post Type Product
add_action( ‘init’, ‘register_themepost’, 20 );
function register_themepost() {
$labels = array(
‘name’ => _x( ‘Product’, ‘catchproduct_custom_post’,’catchproduct’ ),
‘singular_name’ => _x( ‘Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘add_new’ => _x( ‘Add New’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘add_new_item’ => _x( ‘Add New Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘edit_item’ => _x( ‘Edit Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘new_item’ => _x( ‘New Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘view_item’ => _x( ‘View Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘search_items’ => _x( ‘Search Products’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘not_found’ => _x( ‘No Products found’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘not_found_in_trash’ => _x( ‘No Products found in Trash’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘parent_item_colon’ => _x( ‘Parent Product:’, ‘catchproduct_custom_post’, ‘catchproduct’ ),
‘menu_name’ => _x( ‘Product’, ‘catchproduct_custom_post’, ‘catchproduct’ ),

$args = array(
‘labels’ => $labels,
‘hierarchical’ => false,
‘description’ => ‘Custom Product Posts’,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘comments’, ‘revisions’, ‘post-formats’, ‘custom-fields’ ),
‘taxonomies’ => array( ‘product_categories’),
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘show_in_nav_menus’ => true,
‘publicly_queryable’ => true,
‘exclude_from_search’ => false,
‘query_var’ => true,
‘can_export’ => true,
‘rewrite’ => array(‘slug’ => ‘product/%product_categories%’,’with_front’ => FALSE),
‘public’ => true,
‘has_archive’ => ‘product’,
‘capability_type’ => ‘post’
register_post_type( ‘product’, $args );//max 20 charachter cannot contain capital letters and spaces


Display dates as “time ago”, the easy way

change-date-formatWant to display human readable dates on your blog, such as “Posted 6 days ago?” There’s a lot of available functions to do so, but only a few people know that WordPress have its own built-in function to do that.
To display human readable dates on your blog, you have to use the


function. The following piece of code will show a post date like “Posted 6 days ago”.
Paste it anywhere within the loop, save the file, and you’re done.

human_time_diff.(get_the_time.(‘U’), current_time.(‘timestamp’)) . ‘ ago’;

Open source twitter streaming code list

Below are the top Open source twitter streaming code list : –

6 steps to make your contest effective on Facebook.

Why should i run a promotion on Facebook?

If your client or yourself ever wondered what the answer is, contests and promotions are an excellent resource to boost your business and are useful for large, medium or small companies but that it will happen only care about your end user.
Contests and promotions serve for various purposes for example to get more audience, increase the level of community interaction, increase your databases or deliver more traffic to your website and therefore, we have to take care of the details to make them truly effective.
The logic of this resource is that you have to give something to get attention so we have to find ways in which people allow us to share your social life to communicate the message of our brand and promotions are highly effective tools to achieve it.
– OK, you convinced me and I decided to organize a contest but … Where do I start?

1) Set goals:
The first step, as in any marketing action, is to set clear objectives you set out with this move. To do that you have to answer the question: What do you want to achieve with this competition?
For example: increase the visibility of your business, generate databases for use in email marketing activities or to learn more about your fans, increase the size or activity in your community or promote a new product.
Determine this with your team is very important and will influence the competition format that will carry forward and should respect the story it tells of your brand.

2) Follow the rules of Facebook:
It is vital for the survival of your promotion that it respects the Facebook imposes rules for this type of action , you have to use an application like The Fan Machine and not use the social network’s wall.

3) Choose a proper participation mechanic:
There are different ways to activate your community, but is essential to personalize the “stories” of your promotion. This means you have to think and customize each of the publications that participants and voters will share automatically  for a greater virality of your action.
You can do this in step 4 when setting up your promo with The Fan Machine

A) The most common method is the image or photograph contest because of their ease of participation, so it is familiar and widespread in this environment and because Facebook is the best performing mechanical gain fans. Also generate databases for future marketing, colors and images of your brand will always be present and the viral power of the spirit of competition.

B) To convert all your fans into clients, the path is to use a coupon promotion.Using this tool is easy to drive your fans to visiting your point of sale. Participants must sign up for a discount coupon that can be used in your business or digitally. This will increase your sales and activity on your site in an unexpected way.

C) For major contests & promotions you can require a little more to your followers and ask upload a video according to a specific set point and follow the same steps as in the image contest. It is very simple for the fans because with one click your video imported from YouTube and begins a real battle of videos, where experiences and entertainment will be the best result will win your community.

D) Under the same mechanics of voting, there is the possibility of promoting a  story contest(text)that is much easier for participants to participate and is really effective to engage with your community.

E) The simplest way to promote a product, service or event isa sweepstakes, as often happens that people do not participate when the mechanics are too complex or has many steps to complete the registration.

4) An attractive prize:
Keep in mind that the award should have some relationship with the customer required to enter or win. Analyzing your audience is central to achieving greater participation of members of your community.

5) Set clear terms and conditions:
This is another time where you can differentiate yourself from the rest of the mechanical or thematic promotions proposing novel but without losing sight of the simplicity. If you want to achieve engagement is vital that you seek to innovate and be creative to avoid falling into

6) Communication:
When launching a contest or promotion you must not think that automatically you fans know about it.  You must inform to your fans about it with a proper community management work to keep alive the flame of promotions, generating intrigue, causing the competitive spirit among the participants and recalling the reward if they have a target.

Vestibulum eget metus quis odio lacinia aliquet.

Vestibulum eget metus quis odio lacinia aliquet. In a eros ultricies, rhoncus erat ac, lacinia leo. Nunc quam turpis, mattis vel metus id, rhoncus ullamcorper felis. Nullam in luctus tortor, eget varius sem. In et dapibus nisl. Maecenas rutrum volutpat vulputate. Suspendisse vitae convallis nisi. Aliquam tempus vulputate magna, nec varius orci imperdiet at. Donec eget accumsan ipsum. Fusce sollicitudin ligula eu vehicula facilisis.

Donec bibendum dignissim orci sed feugiat. Duis id mauris ut mi tristique suscipit. Suspendisse sit amet mi quis elit sagittis sollicitudin sit amet eu magna. Donec mollis tortor vel diam blandit laoreet. Etiam convallis lacus vel justo posuere, id interdum est cursus. Aliquam erat volutpat. Duis non dolor dapibus, ultrices eros at, ullamcorper est. Donec quis quam accumsan, placerat risus eu, aliquam mi. Donec malesuada felis et lacus molestie porttitor. Sed blandit aliquet justo. Aenean dictum, erat eget fringilla imperdiet, risus risus posuere sem, id viverra nunc diam eget augue. Duis dictum ante justo, non blandit dolor suscipit et.

Quisque leo augue, congue quis nunc suscipit, consectetur porta sapien. Mauris interdum tempor eleifend. Cras pulvinar mollis massa in tincidunt. Nulla facilisi. Integer eleifend, nibh sed fermentum rutrum, odio justo vulputate neque, mattis ullamcorper justo arcu quis nisl. Aliquam ultricies, sapien sed fringilla ultrices, nibh purus tincidunt urna, nec interdum elit elit et magna. Maecenas dapibus interdum justo vitae commodo. Phasellus dignissim elit quis turpis faucibus, eleifend cursus nulla tincidunt. Duis porta tortor non diam consequat, nec dictum est ultrices. Nam nec ante vitae mi vulputate sodales non vitae tellus. In varius dictum tortor, et fermentum nisi dictum id. Nam fermentum magna et orci vehicula facilisis. Sed ultricies aliquam tortor ut volutpat.

Morbi pellentesque mollis lorem eu feugiat. Donec vitae turpis feugiat, fringilla sapien a, dictum justo. Nunc est orci, lacinia sit amet aliquet sit amet, interdum quis est. Nulla quis convallis tortor. Aenean porttitor arcu ac mi vulputate sodales. Praesent quis ante ultrices dolor malesuada hendrerit eu vitae erat. Sed fringilla sem ligula, a gravida tellus consectetur non. Donec nisi nisi, iaculis et varius vel, sollicitudin et mi. Nunc tempor a augue sit amet bibendum. Vestibulum quis sapien condimentum, porttitor lorem quis, consequat est. Vestibulum tempus gravida pretium. In quis est vel mauris suscipit auctor. Nam sagittis, ipsum bibendum fermentum mollis, lectus justo gravida elit, sit amet laoreet neque eros ut risus. Praesent nibh urna, lacinia eget diam ultricies, varius tincidunt nunc. Praesent sit amet euismod velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Integer facilisis, odio ac rhoncus mattis, nunc mauris pulvinar nibh, quis molestie magna enim at turpis. Aenean quis laoreet risus, ut molestie quam. Etiam quis enim vel lectus vulputate faucibus tempus a odio. Sed dolor dui, eleifend quis leo nec, consectetur mattis sapien. Quisque interdum enim sed lacinia fermentum. Vestibulum interdum id arcu in pulvinar. Interdum et malesuada fames ac ante ipsum primis in faucibus. Fusce mattis eros id mi hendrerit pellentesque quis et urna. Nunc pellentesque, dolor non ultrices porta, sapien lorem molestie velit, tempor sagittis est magna at lectus. Integer tempus gravida mauris, sed vulputate urna molestie ac.