This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Exclude category from feed */ | |
function excludecatfeed($query) { | |
if(is_feed()) { | |
$query->set('category__not_in','-1'); | |
return $query; | |
} | |
} | |
add_filter('pre_get_posts', 'excludecatfeed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Twitter share --> | |
<a href="http://twitter.com/?status=<?php the_title(); ?>%20<?php echo wp_get_shortlink(get_the_ID()); ?>" onclick="window.open(this.href); return false;">TWITTER</a> | |
<!-- Facebook --> | |
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" onclick="window.open(this.href); return false;">FACEBOOK</a> | |
<!-- Google plus --> | |
<a href="https://plus.google.com/share?url=<?php the_permalink();?>" onclick="javascript:window.open(this.href,'', 'menubar=no, toolbar=no, resizable=yes, scrollbars=yes,height=600,width=600');return false;">Google plus</a> | |
<!-- Pinterest --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Test_Setting_Admin extends Genesis_Admin_Boxes { | |
/** | |
* Create an admin menu item and settings page. | |
* | |
* @since 1.0 | |
*/ | |
function __construct() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is helper function will get attachment ID based on src | |
* | |
* @see http://wordpress.org/support/topic/need-to-get-attachment-id-by-image-url | |
*/ | |
function get_attachment_id_from_src( $url ) { | |
global $wpdb; | |
$id = url_to_postid( $url ); | |
if( $id == 0 ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// verify that this is a product category page | |
if (is_product_category()){ | |
global $wp_query; | |
// get the query object | |
$cat = $wp_query->get_queried_object(); | |
// get the thumbnail id user the term_id | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
// get the image URL | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
// print the IMG HTML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'ayo_redirect_plugin_activation' ); | |
function ayo_redirect_plugin_activation(){ | |
global $pagenow; | |
if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'plugins.php' ) | |
wp_redirect( admin_url( 'options-general.php?page=plugin-page-slug' ) ); | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Using transients on a single loop inside WordPress | |
* | |
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/ | |
* / | |
$loop = get_transient( 'loop' ); | |
if ( false === $loop ) { | |
// Show the last 100 tweets from the custom post type tweets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Caching Widgets with transients | |
* | |
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/ | |
* / | |
class show_ak_events_Widget extends WP_Widget { | |
function show_ak_events_Widget() { | |
/* Widget settings. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Using caching for theme options | |
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/ | |
* / | |
function my_get_cache_option($option_name = 'ThemeAdminOptions' ){ | |
// get wanted transient | |
$value = get_transient( $option_name ); | |
// check if it has any content | |
if(false === $value){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* automatically echo to the screen using transient | |
* | |
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/ | |
* / | |
$loop_output = get_transient( 'loopOutput' ); | |
if ( false === $loop_output ) { | |
OlderNewer