Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove After Entry Widget on one Page
Tagged: after entry widget
- This topic has 15 replies, 2 voices, and was last updated 5 years, 2 months ago by Victor Font.
-
AuthorPosts
-
February 6, 2019 at 7:12 pm #489368rogerpParticipant
I am using the After Entry Widget to get people to go to my sales page on my website.
But once there I don't want the After Entry Widget to show on that specific page.
is there any way to stop the After Entry Widget showing on a specific page?
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 6, 2019 at 10:36 pm #489375Victor FontModeratorWhat theme are you using?
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 7, 2019 at 3:58 am #489385rogerpParticipantIt's the Smart Passive Income Theme
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 7, 2019 at 7:53 am #489390Victor FontModeratorYour theme activates the after entry widget in functions.php at line 110. Wrapping that in in the WordPress is_page() conditional should work. I'm assuming your sales page is the one that discusses prices? If so, try this:
if ( is_page('4201') ) { add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 ); }
If this doesn't work, we'll have to figure out a different way to do it.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 7, 2019 at 5:58 pm #489412rogerpParticipantThe page I wanted was actually post 8721
I added this code to my functions.php and it broke my site?Is there a specific place it should go or is the code wrong?
//* Remove After_Entry_on_Course_Page ID 8721
if ( is_post('8721') ) {
add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );
}
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 8, 2019 at 5:21 pm #489426Victor FontModeratorActually, it should by if (!is_page('8721') ). I left the ! out.
You have is_post(). There is no WordPress conditional named is_post(). If you're testing for a post, you use is_single().
https://codex.wordpress.org/Conditional_Tags
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 8, 2019 at 6:14 pm #489431rogerpParticipantThanks Victor,
Code added now -
//* Remove After_Entry_on_Course_Page ID 8721if (!is_single('8721') ) {
add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );
}However After Entry Widget still shows?
I don't see the logic here, surely it should be remove_action?
https://www.rogerperkin.co.uk/network-automation/ansible/network-automation-training/
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 8, 2019 at 7:51 pm #489433Victor FontModeratorThe logic means do the add action for all except what’s in the if statement. Is your sales page a page or a post? You have to use is_page for pages and is_single for posts.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 9, 2019 at 6:20 am #489437rogerpParticipantOk makes sense, still not working does the extra code need to go near the add_entry code in functions.php
i.e
76: //* Add support for after entry widget and move it inside
77: add_theme_support( 'genesis-after-entry-widget-area' );
78: remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
79: add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );126: //* Remove After_Entry_on_Course_Page ID 8721
127: if (!is_single('8721') ) {
128: add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );
129: }The page I want this to happen on is a post and when I edit the post it says pageid 8721
post=8721&action=edit
So what am I missing?
Thanks
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 9, 2019 at 7:50 am #489441Victor FontModeratorNow you have add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 ); in there twice. All you had to do was wrap the original add_action in the if statement.
I wasn't giving you extra code to add. I never suggested that you do that. I showed you how to modify the existing code to make it work the way you want it to.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 9, 2019 at 3:39 pm #489452rogerpParticipantOk making progress now
Code now looks like this
//* Add support for after entry widget and move it inside
add_theme_support( 'genesis-after-entry-widget-area' );
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
if (!is_single('8721') ) {
add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );
}However nothing happens, if I remove the ! it removes the after entry widget on all pages?
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 9, 2019 at 6:52 pm #489455Victor FontModeratorThere’s no need for the remove action. Delete that line.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 9, 2019 at 7:18 pm #489456rogerpParticipantOk, now i get two after entry widgets?
//* Add support for after entry widget and move it inside
add_theme_support( 'genesis-after-entry-widget-area' );if (!is_single('8721') ) {
add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 );
}
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 10, 2019 at 7:08 am #489463Victor FontModeratorLet's try this again, I just noticed the developer changed the priority for the after entry widget area, which makes things a little more complicated. This would be the easiest way to do it. Try this:
// Add support for after entry widget and move it inside. add_theme_support( 'genesis-after-entry-widget-area' ); remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); add_action( 'genesis_entry_content', 'genesis_after_entry_widget_area', 15 ); if ( is_single('8721') ) { remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 15 ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 10, 2019 at 5:25 pm #489472rogerpParticipantThanks for your determination Victor, but that code did not work
I think I need to approach the developer
Regards,
Roger
Roger
https://www.rogerperkin.co.uk/
Check out my Network Automation Training – Training the Network Engineers of the FutureFebruary 10, 2019 at 5:37 pm #489474Victor FontModeratorI give up anyway. Without access to the back end of the site, it's not possible to check why it's not working. That code should work though.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.