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 list_child_pages() { | |
global $post; | |
if ( is_page() && $post->post_parent ) | |
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' ); | |
else | |
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' ); | |
if ( $childpages ) { | |
$string = '<ul>' . $childpages . '</ul>'; |
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
<div <?php post_class( get_the_ID() == get_queried_object_id() ? 'oxy-post current-post' : 'oxy-post'); ?>> | |
<a class='oxy-post-title' href='<?php the_permalink(); ?>'><?php the_title(); ?></a> | |
</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( 'excerpt_length', 'custom_excerpt_length', 999 ); | |
/** | |
* Change the length of excerpt. | |
* | |
* @param int $length The number of words. Default 55. | |
* @return int New excerpt length. | |
*/ | |
function custom_excerpt_length( $length ) { | |
return 20; // number of words. Default is 55. |
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 to check if the current Page is a parent or not. | |
* @return bool true (1) if the current Page has children else false (0) | |
*/ | |
function wpdd_is_parent_page() { | |
// Load details about this page. | |
$post = get_post(); |
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 the function to advanced scripts (or code snippet) | |
// Create a condition in the builder to the section where you want to hide | |
// Select dynamic data -> php function -> “Check_CPT_Repeater” | |
// Inside the arguments section add your "cpt_name" and post object "acf_field" | |
// Set dynamic data == 0 (to hide if no results are returned) | |
function Check_CPT_Repeater( $cpt_name, $acf_field ){ | |
//WP_Query arguments | |
$args = array( |
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 Custom Code - plugins loaded | |
if ( function_exists( 'acf_add_options_page' ) ) { | |
acf_add_options_page(); | |
} | |
function tct_field($field_name) { | |
return get_field( $field_name, 'option' ); | |
} |
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
/*Put this in the header*/ | |
html{visibility: hidden;opacity:0;} | |
/*Put this in the footer*/ | |
html { | |
visibility: visible; | |
opacity: 1; | |
} |
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
//Get the Custom Post Type | |
// -1 means we get all the posts type. | |
<?php | |
$things = get_posts(['post_type' => 'CPT','posts_per_page' => -1]); | |
//Start with 0 calories | |
$total = 0; | |
//Then Loop through all the posts in your CPT | |
Foreach($LotsofPosts as $singlePost): | |
//well grab the calories from each post |