To add a custom currency paste this code in your theme functions.php file or in a complementary plugin for WooCommerce and swap out the currency code and symbol with your own. After doing so it will be available from WooCommerce settings. add_filter( 'woocommerce_currencies', 'add_my_currency' ); function add_my_currency( $currencies ) { $currencies['ABC'] = __( 'Currency name', 'woocommerce' ); return … Continue reading WordPress: WooCommerce: Add a custom currency / symbol
Category: WordPress
Override WooCommerce Template File Within a Plugin The goal of this article is to describe one approach to overriding WooCommerce core template files within a custom plugin, such that they can still beoverridden by a theme in the typical way. Note that this is similar to but solves a slightly different problem than what we did to create a custom … Continue reading WordPress: WooCommerce plugin: How to Override WooCommerce Template File Within a Plugin
How to add menu order support to posts and other post types ? add_action( 'admin_init', 'posts_order' ); function posts_order(){ add_post_type_support( 'post', 'page-attributes' ); }
Have you ever been developing in wordpress and did not found the featured image box ? Sure you have missed adding the support to post thumbnails, just check that this line is present in your functions.php add_theme_support( 'post-thumbnails' );
<?php /** * WordPress Query Comprehensive Reference * Compiled by luetkemj - luetkemj.com * * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query * Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php */ $args = array( //////Author Parameters - Show posts associated with certain author. 'author' => 1,2,3, //(int) - use author id [use minus (-) to exclude authors by ID ex. 'author' => -1,-2,-3,] 'author_name' => … Continue reading WordPress: Using WP_Query Arguments
/** * get the sources of img tags from html input parameter */ function get_html_img_sources($html){ //$html = types_render_field( "gallery_image", array( "size" => "medium", "proportional" => "true",'output'=>'raw') ); if(empty($html)) return array(); $doc = new DOMDocument(); $doc->loadHTML($html); $imageTags = $doc->getElementsByTagName('img'); $img_src_arr = array(); foreach($imageTags as $tag) { $img_src_arr[] = get_site_url().'/'.substr( $tag->getAttribute('src'), strrpos( $tag->getAttribute('src'), '/wp-content' )+1 ); } … Continue reading Get the sources of img tags from html
How to get featured image "thumbnail" for a post? $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo '$feat_image';