Contact form field in wordpress menu

Well, you’re getting error, because your code is not correct… There is syntax error in this line (You combine string and PHP code in there…): $items .= ‘<li class=”menu-item”>echo do_shortcode( ‘[contact-form-7 id=”1323″ title=”Newsletter”]’ );</li>’; It should look like this: add_filter( ‘wp_nav_menu_items’, ‘your_custom_menu_item’, 8, 2 ); function your_custom_menu_item ( $items, $args ) { if( $args->theme_location == … Read more

Change shortcode output (filter?)

I was able to solve this by using str_replace. function mp_filter_download( $result ) { $search=”<div style=”clear:both;”></div>”; $replacewith=” “; return str_replace( $search, $replacewith, $result ); } add_filter( ‘downloads_shortcode’, ‘mp_filter_download’, 10, 2 );

How to add conent (text) to Add New pages form of admin in WordPress

The hook to use here is admin_notices. However in register_activation_hook and register_deactivation_hook it shouldn’t be used because these function run when plugin activates and deactivates instance. A workaround it we use add_option when plugin activates and delete_option when plugin deactivates. Here is the code. Hopefully you will understand it properly <?php function my_admin_notice() { $screen … Read more

apply_filters to $GLOBALS

Assuming that $GLOBALS[‘Pootle_Page_Builder_Render_Layout’] carries an instance of Pootle_Page_Builder_Render_Layout, the method panels_render() returns a string. So you can simply pass the method call as an argument to apply_filters(): $content = apply_filters( ‘the_content’, $GLOBALS[‘Pootle_Page_Builder_Render_Layout’]->panels_render( $page_data->ID ) ); I’m not sure whether this is an intended use of the API of the plugin, as Pootle_Page_Builder_Render_Layout::panels_render() remove some default … Read more