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
@mixin aspect-ratio($width, $height) { | |
position: relative; | |
&:before { | |
display: block; | |
content: ""; | |
width: 100%; | |
padding-top: ($height / $width) * 100%; | |
} | |
> .content { | |
position: absolute; |
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
// Load translation files from your child theme instead of the parent theme | |
function my_child_theme_locale() { | |
load_child_theme_textdomain( 'total', get_stylesheet_directory() . '/languages' ); | |
} | |
add_action( 'after_setup_theme', 'my_child_theme_locale' ); |
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
function my_assets() { | |
wp_enqueue_script( 'myscriptid', get_stylesheet_directory_uri() . 'js/myscripts.js', array( 'jquery' ) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_assets' ); |
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
add_filter('widget_text','do_shortcode'); |
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
add_filter( 'the_content', 'my_the_content_filter', 20 ); | |
function my_the_content_filter( $content ) { | |
if ( is_single() ) | |
{ | |
global $post; | |
$field = get_fields($post_id); | |
$imgLnk=get_bloginfo( 'stylesheet_directory' ); | |
$pgLnk=get_post_meta($post->ID, 'Button', true); | |
$content .= '<div class="cf-wrap">CF go here<br> ' .$field. '</div>'; | |
} |
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
function wd_hierarchical_tags_register() { | |
// Maintain the built-in rewrite functionality of WordPress tags | |
global $wp_rewrite; | |
$rewrite = array( | |
'hierarchical' => false, // Maintains tag permalink structure | |
'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', | |
'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(), |
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
add_action('init', 'renameCategory'); | |
function renameCategory() { | |
global $wp_taxonomies; | |
$cat = $wp_taxonomies['category']; | |
$cat->label = 'Por Tipos'; | |
$cat->labels->singular_name = 'Por Tipo'; | |
$cat->labels->name = $cat->label; | |
$cat->labels->menu_name = $cat->label; | |
//… |
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 | |
/** | |
* Display a custom taxonomy dropdown in admin | |
* @author Mike Hemberger | |
* @link http://thestizmedia.com/custom-post-type-filter-admin-custom-taxonomy/ | |
*/ | |
add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy'); | |
function tsm_filter_post_type_by_taxonomy() { | |
global $typenow; |
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
/** Set Child Terms to Parent Terms **/ | |
function set_parent_terms( $post_id, $post ) { | |
if ( 'publish' === $post->post_status && $post->post_parent > 0 ) { | |
$parent = get_post($post->post_parent); | |
if(!empty($parent)){ | |
$taxonomies = get_object_taxonomies( $parent->post_type ); | |
foreach ( (array) $taxonomies as $taxonomy ) { | |
$terms = wp_get_post_terms( $parent->ID, $taxonomy ); | |
if ( !empty( $terms ) ) { |
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
function get_topmost_parent($post_id){ | |
$parent_id = get_post($post_id)->post_parent; | |
if($parent_id == 0){ | |
return $post_id; | |
}else{ | |
return get_topmost_parent($parent_id); | |
} | |
} |