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 | |
// https://businessbloomer.com/woocommerce-remove-specific-category-shop-loop/ | |
// https://stackoverflow.com/questions/34684881/hide-products-from-users-who-are-not-logged-in-using-tags/34689768#34689768 | |
add_action( 'woocommerce_product_query', 'show_hide_products_category_shop' ); | |
function show_hide_products_category_shop( $q ) { | |
$tax_query = (array) $q->get( 'tax_query' ); | |
if ( is_user_logged_in() ) { |
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
// Made by Isaac: https://gist.github.com/itzikbenh/16326bc3947f272cd6bb44de03c4774b?fref=gc&dti=168889943173228 | |
// and improved by Ian. https://www.facebook.com/groups/advancedwp/permalink/1607185879343620/ | |
function add_category_meta_fields( $taxonomy ) { | |
?> | |
<div class="form-field create-cat term-featured-image-wrap"> | |
<label for="tax-featured-image">Featured Image</label> | |
<input id="tax-featured-image" type="text" name="featured_image"> | |
<br> | |
<button id="add-cat-featured-img" class="button" name="button">Add Featured Image</button> |
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
// At http://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options bottom comment the following code $hidden is mentioned. | |
// Hides meta boxes. Turn them on through the Screen Options. | |
add_filter( 'hidden_meta_boxes', 'custom_hidden_meta_boxes' ); | |
function custom_hidden_meta_boxes( $hidden ) { | |
// Hide meta boxes on the single Post screen | |
// Left column | |
$hidden[] = 'postexcerpt'; // Post Excerpts | |
$hidden[] = 'trackbacksdiv'; // Send Trackbacks | |
$hidden[] = 'postcustom'; // Custom Fields | |
$hidden[] = 'commentstatusdiv'; // Discussion |
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
// GENESIS get featured image. | |
// 1. Sets the featured image. | |
// 2. If no featured image then get image from category. | |
// 3. If no category image then get the first post image. | |
// 4. If no post image or category image then set a fallback image. | |
// Add to your functions file. | |
// Resources | |
// https://wordpress.org/support/topic/make-first-image-in-post-featured-if-no-featured-is-set?replies=9 | |
// http://wpsites.net/web-design/add-default-featured-image-for-each-post-in-a-category/ |
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
// Inside your functions file add the following code | |
// | |
function wpforce_featured() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); // If post have a featured image use that. | |
if (!$already_has_thumb) { | |
// If post does not have a featured image then get the first post image and set as featured image. | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); // Number 1 relates to taking post image number 1 and adding it as a featured image. | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { |
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
//Altitude Pro customize.php code - | |
// Tutorial I am brushing up is here: http://easywebdesigntutorials.com/customizing-altitude-pro-genesis-child-theme/ | |
<?php | |
/** | |
* Customizer additions. | |
* | |
* @package Altitude Pro | |
* @author StudioPress | |
* @link http://my.studiopress.com/themes/altitude/ |
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
// Customize the post meta "FILED UNDER: -category name-" categories text and below the post preview in a blog page and change it at the bottom of a post. | |
// http://wordpress.stackexchange.com/questions/50961/removing-post-meta-from-category-pages */ | |
// | |
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' ); | |
function sp_post_meta_filter($post_meta) { | |
if ( !is_page() ) { | |
if (is_archive() ) $post_meta = ''; | |
else $post_meta = '[post_categories before="Categories: "] [post_tags before="Keywords: "]'; | |
return $post_meta; | |
}} |
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
// Adding code to create an effect on the header/nav on scroll | |
jQuery(function( $ ){ | |
if( $( document ).scrollTop() > 0 ){ | |
$( '.site-header' ).addClass( 'dark' ); | |
} | |
// Add opacity class to site header | |
$( document ).on('scroll', function(){ |
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
/* The below code removes all the default WordPress widgets. I commeted the ones I do not want to remove. */ | |
// unregister all widgets | |
function unregister_default_widgets() { | |
unregister_widget('WP_Widget_Pages'); | |
unregister_widget('WP_Widget_Calendar'); | |
unregister_widget('WP_Widget_Archives'); | |
unregister_widget('WP_Widget_Links'); | |
unregister_widget('WP_Widget_Meta'); | |
unregister_widget('WP_Widget_Search'); |
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
//* Define a default post thumbnail | |
//* http://dreamwhisperdesigns.com/genesis-tutorials/genesis-default-thumbnails/ | |
add_filter('genesis_get_image', 'default_image_fallback', 10, 2); | |
function default_image_fallback($output, $args) { | |
global $post; | |
if( $output || $args['size'] == 'full' ) | |
return $output; | |
$thumbnail = CHILD_URL.'/images/WordPress-info150x150.jpg'; |