I want to add a "widget" in my No Sidebar post/page

Community Forums Forums General Discussion I want to add a "widget" in my No Sidebar post/page

This topic is: not resolved

This topic contains 21 replies, has 3 voices, and was last updated by  braddalton 1 year ago.

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #44320

    lwoods
    Participant
    Post count: 22

    I want to add a piece of code into my form (or page) content area.  For example, I have a “No Sidebar” page that is an “About Us” but I would like to drop a “Sign up for our Newsletter” box into the content area; maybe on the right, for example.  But I want the content to flow around the box.  In other words it would be the same as having an image in my content but it’s a piece of code instead.

    How?

    Thanks

    #44322

    braddalton
    Participant
    Post count: 8883

    Link to that page please.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #44326

    lwoods
    Participant
    Post count: 22

    Sorry, but I don’t understand your message.  Link to what page?

    #44337

    braddalton
    Participant
    Post count: 8883

    Your About Us” page please.

    I’d like to take a look.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #44338

    lwoods
    Participant
    Post count: 22

    Hi,

    Sorry but I haven’t built it yet.  Just want to know how to do it.  I think that answer is to find a plugin with a shortcode that I can drop into my content area.

    #44345

    braddalton
    Participant
    Post count: 8883

    No worries.

    Post this when you have got the site up and i’ll give you the solution.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51670

    Chrissy Marquardt
    Participant
    Post count: 27

    Hey Brad, you’ve helped me out before and Im working on a new project and had the same question. Using the Innov8tive theme for my blog and I was able to figure out how to get my newsletter box to appear below posts but I want it to appear below my About page. I know its some code I have to put in the php file but just not sure what it is

    http://www.cleaneatingsimplified.com/about/

    Thanks


    #51711

    braddalton
    Participant
    Post count: 8883

    What great timing. I just wrote about this for another community member.

    http://www.studiopress.com/forums/topic/modern-portfolio-about-widget/#post-51709


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51905

    Chrissy Marquardt
    Participant
    Post count: 27

    Hey Brad,

    I read the other post and I had some follow up questions. Here is the code I have at the bottom of my themes php file that I grabbed based on a tutorial Brian Gardener posted on the eNews extended plugin

    //* Add the newsletter widget after the post content
    add_action( 'genesis_after_post_content', 'custom_add_newsletter_box' );
    function custom_add_newsletter_box() {
    	if ( is_singular( 'post' ) )
    	genesis_widget_area( 'newsletter', array(
    		'before' => '<div id="newsletter">',
    	) );
    }

    So I want to add my newsletter sign up box after my about page and my contact me page ( possibly some other pages in the future but we’ll start there for now). What code would I put in the php file ?

    Thanks again !


    #51936

    braddalton
    Participant
    Post count: 8883

    Change the line for the conditional tag to an array:
    [php]
    if ( is_singular( ‘post’ ) )
    [/php]

    To this:

    [php]
    if (is_page( array( ‘about-me’, ‘contact-me’ ) ) )
    [/php]

    Use the page slug or page i.d’s

    If it doesn’t work, try removing the single quotes and use the page i.d.
    [php]
    if ( is_page( array( 007, 1180 ) ) )
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #52399

    Chrissy Marquardt
    Participant
    Post count: 27

    Hey again

    Thanks for your help with this. I would like to keep my subscription box below my posts AND have it below the contact me and about page. So would it look like this:

    //* Add the newsletter widget after the post content
    add_action( ‘genesis_after_post_content’, ‘custom_add_newsletter_box’ );
    function custom_add_newsletter_box() {
    if ( is_singular( ‘post’ ) )
    if (is_page( array( ‘about’, ‘contact-me’ ) ) )
    genesis_widget_area( ‘newsletter’, array(
    ‘before’ => ‘<div id=”newsletter”>’,
    ) );
    }
    `
    Thanks again. Really appreciate your input


    #52421

    braddalton
    Participant
    Post count: 8883

    You could also use this code:

    https://gist.github.com/braddalton/6077458


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #52495

    lwoods
    Participant
    Post count: 22

    Brad:

    In the previous reply is “dynamic_sidebar()” a method in a plug-in?

    Thanks

    #52498

    braddalton
    Participant
    Post count: 8883

    This Conditional Tag checks if the current sidebar has active widgets.

    Source http://codex.wordpress.org/Function_Reference/is_dynamic_sidebar


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #52511

    lwoods
    Participant
    Post count: 22

    Thanks for the info, Brad. I was just trying to figure out what the call to dynamic_sidebar did. In your example it doesn’t look like it’s doing anything—or am I missing something. The codex doc says that it returns true/false.

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic.