admin管理员组文章数量:1278918
I want to add some gravity forms filters in my functions.php. I have the code up and running, but I would like to improve this snippet with a condition. As I only need these filters on 1 page of my website, it doesn't make sense for it to run site-wide. I'm not a programmer. I tried a couple of ways to put this code snippet under the condition: "if (is_page( array( 'post-form' ) ) ) {" but without success. I know it's possible to add this conditional inside each function, but that doesn't look very good, and I'd like more optimized code:
add_filter( 'gform_rich_text_editor_buttons_17', 'gravityfpega_botoestiny', 10, 2 );
function gravityfpega_botoestiny() {
$mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'spellchecker' ); // Enable only Bold, Italic and Bullet List buttons
return $mce_buttons;
}
add_filter( 'gform_rich_text_editor_buttons_row_two_17', 'gravityfpega_botoestiny2', 10, 2 );
function gravityfpega_botoestiny2() {
$mce_buttons = array( 'strikethrough', 'hr', 'forecolor', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ); // Enable only Bold, Italic and Bullet List buttons
return $mce_buttons;
}
function gravityfpega_mediatinymce( $editor_settings, $field_object, $form, $entry ) {
$editor_settings['media_buttons'] = true;
$editor_settings['editor_height'] = 600;
return $editor_settings;
}
add_filter( 'gform_rich_text_editor_options_17', 'gravityfpega_mediatinymce', 10, 4 );
function gravityfpega_dragdroptinymce( $editor_settings, $field_object, $form, $entry ) {
$editor_settings['drag_drop_upload'] = true;
return $editor_settings;
}
//loads script to do the oembed stuff
function alt_lab_front_end_scripts(){
wp_enqueue_editor();
wp_enqueue_script( 'mce-view', '', array('tiny_mce') );
}
add_action( 'wp_enqueue_scripts', 'alt_lab_front_end_scripts' );
add_filter( 'gform_rich_text_editor_options_17', 'gravityfpega_dragdroptinymce', 10, 4 );
add_filter( 'gform_advancedpostcreation_excerpt', 'enable_excerpt', 10, 1 );
function enable_excerpt( $enable_excerpt ){
return true;
} }
//
if ( class_exists( 'GW_Save_Continue_Auto_Load' ) ) {
new GW_Save_Continue_Auto_Load( array(
'form_ids' => array( 17 ),
'enable_inline_confirmation' => true,
'auto_save' => true
) );
}
Can someone help me please?
本文标签: How add various functions within 1 conditional
版权声明:本文标题:How add various functions within 1 conditional? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741262676a2367910.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论