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
// https://wordpress.org/plugins/custom-content-shortcode/ | |
<div class="section group wrap"> | |
[loop type=post category=my-category-slug count=10] | |
<div class="section group"> | |
<div class="col span_1_of_2"> | |
[field image size="image-size-name"] | |
</div> | |
<div class="col span_1_of_2"> | |
<div class="fecha">[field date]</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
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
<?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); | |
} | |
} |
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
https://wordpress.org/support/topic/conditional-statement-is-page-a-grandchild?replies=6 | |
http://wordpress.stackexchange.com/questions/182017/a-check-for-if-is-parent-page-if-has-children-if-has-grandchildren | |
<?php if( count(get_post_ancestors($post->ID)) == 2 ) echo 'this is grandchild of top page'; ?> | |
<?php if( count(get_post_ancestors($post->ID)) >= 2 ) echo 'this is grandchild of some page'; ?> | |
try and echo the post id before the code to see if it is the one of the page you are on: | |
maybe also add a is_page() conditional: | |
<?php |
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
foreach ( array( 'pre_term_description' ) as $filter ) { | |
remove_filter( $filter, 'wp_filter_kses' ); | |
} | |
foreach ( array( 'term_description' ) as $filter ) { | |
remove_filter( $filter, 'wp_kses_data' ); | |
} |
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 | |
function append_language_class($classes){ | |
$classes[] = ICL_LANGUAGE_CODE; //or however you want to name your class based on the language code | |
return $classes; | |
} | |
add_filter('body_class', 'append_language_class'); | |
?> |