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 | |
/** | |
* Add the link post type to the query args passed to the listing query | |
*/ | |
add_filter('nestedpages_page_listing', 'nestedpages_add_links_to_listing', 10, 2); | |
function nestedpages_add_links_to_listing($query_args, $post_type) | |
{ | |
if ( $post_type->name == 'custom-post-type' ) $query_args['post_type'][] = 'np-redirect'; | |
return $query_args; | |
} |
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
/** | |
* In this example, we're adding a custom "acf/carousel" block to the array of supported block types for block animations | |
* We've added this JS file to the script dependencies required by the plugin, using the wp_block_animations_script_dependencies hook. | |
* Additionally, when enqueueing this file, we've added `wp-hooks` as a dependency to ensure the global object is available | |
*/ | |
wp.hooks.addFilter( | |
'wp_block_animations_allowed_blocks', | |
'allowed_blocks', | |
addCustomBlockAnimations |
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 | |
add_filter('wp_block_animations_script_dependencies', 'blockAnimationDependencies); | |
/** | |
* We are adding our custom script containing our addFilter reference to the plugin dependencies. | |
* This way, we ensure the plugin scripts run after we add our filter | |
*/ | |
function blockAnimationDependencies($deps) | |
{ | |
$deps[] = 'custom-script-handle'; |
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 | |
add_filter('nestedpages_row_parent_css_classes', 'nestedpages_filter_row_css_classes', 10, 3); | |
/** | |
* Filter the <li> element css classes for nested pages rows | |
* @param str - $row_classes - the CSS classes for output | |
* @param obj - $post - the current post object | |
* @param obj - $post_type_object - the current post type object | |
*/ | |
function nestedpages_filter_row_css_classes($row_classes, $post, $post_type_object) | |
{ |
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 | |
/** | |
* Filters radio choices to include the next 14 days | |
* | |
* Place in the theme's functions.php file | |
* @link https://docs.gravityforms.com/dynamically-populating-drop-down-fields/ | |
*/ | |
add_filter( 'gform_pre_render_1', 'populate_dates' ); | |
add_filter( 'gform_pre_validation_1', 'populate_dates' ); | |
add_filter( 'gform_pre_submission_filter_1', 'populate_dates' ); |
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 | |
/** | |
* Filters radio choices to include the next 14 days | |
* | |
* Place in the theme's functions.php file | |
* @link https://docs.gravityforms.com/dynamically-populating-drop-down-fields/ | |
*/ | |
add_filter( 'gform_pre_render_1', 'populate_dates' ); | |
add_filter( 'gform_pre_validation_1', 'populate_dates' ); | |
add_filter( 'gform_pre_submission_filter_1', 'populate_dates' ); |
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( 'gform_editor_js', 'replaceInputsWithTextareas' ); | |
function replaceInputsWithTextareas() { | |
?> | |
<script type='text/javascript'> | |
gform.addAction('gform_load_field_choices', function(field){ | |
field = GetSelectedField(); | |
replaceInputs(field.id) | |
}); | |
jQuery(document).on('gform_load_field_settings', function(e,field){ | |
setTimeout(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
add_filter('nestedpages_quickedit_custom_fields', addCustomPageFieldsLeft, 10, 3); | |
function addCustomPageFieldsLeft($fields, $post_type, $column) | |
{ | |
if ( $column !== 'left' ) return $fields; // fields may be added to the left and right column | |
if ( $post_type->name !== 'post-type-name' ) return $fields; // add fields based on post type | |
$fields = [ | |
[ | |
'key' => 'field_name', // The meta key name | |
'label' => __('Custom Field', 'wp-nested-pages'), // The label for the field | |
'type' => 'date', // date|text|select |
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('nestedpages_page_listing', 'nestedpagesQueryFilter'); | |
function nestedpagesQueryFilter($args) | |
{ | |
$args['post_status'][] = 'custom_post_status'; | |
return $args; | |
} |
NewerOlder