This file contains hidden or 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.stackexchange.com/questions/35724/function-to-return-true-if-current-page-has-child-pages | |
function wpb_list_child_pages() { | |
global $post; | |
// does page have children? | |
$children = get_pages( array( 'child_of' => $post->ID ) ); | |
if( count( $children ) == 0 ) { | |
// not a parent page, | |
// show children page links of parent |
This file contains hidden or 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 | |
/* | |
Plugin Name: CWD YouTube Channel | |
Version: 0.1 | |
Plugin URI: http://www.celticwebdesign.net | |
Description: Render YouTube video count | |
Author: Darren Stevens | |
Author URI: http://www.celticwebdesign.net | |
*/ |
This file contains hidden or 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
<select name="cat" onChange="window.document.location.href=this.options[this.selectedIndex].value;"> | |
<?php | |
$args = array( | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => 1, | |
); | |
$categories = get_categories($args); | |
This file contains hidden or 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://stackoverflow.com/questions/6401268/how-do-i-select-the-last-child-with-a-specific-class-name-in-css | |
if ( $( "section.recipe-collections" ).length > 1 ) { | |
$( "section.recipe-collections" ).last().addClass( "last" ); | |
} | |
// Allows the selection of the last element with specific class. |
This file contains hidden or 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
$post_id = get_field('above_footer'); | |
$vcM = Vc_Manager::getInstance(); | |
$vc = $vcM->vc(); | |
$vc->addShortcodesCustomCss( $post_id ); | |
$post = get_post($post_id, OBJECT); | |
$content = $post->post_content; | |
$content = apply_filters('wpautop', $content); |
This file contains hidden or 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.stackexchange.com/questions/87261/checkboxes-in-registration-form | |
// REGISTRATION | |
add_action( 'register_form', 'signup_fields_wpse_87261' ); | |
add_action( 'user_register', 'handle_signup_wpse_87261', 10, 2 ); | |
// PROFILE | |
add_action( 'show_user_profile', 'user_field_wpse_87261' ); |
This file contains hidden or 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://codex.wordpress.org/Plugin_API/Action_Reference/admin_footer | |
function my_admin_add_js() { | |
echo ' | |
<script type="text/javascript"> | |
var ajaxurl = "'.admin_url("admin-ajax.php").'"; | |
var user_id = '.get_current_user_id().'; | |
</script> |