• Resolved gregsimas

    (@gregsimas)


    Danny,

    Just made a comment on your blog…working through the black box. Is there any way I can keep the box in the sidebar normal ( ie black text and white background not centered) and the box under the single posts black ( ie black box with white text centered ). I feel like the black box in the sidebar might crowd the page a bit. Though, I do like the fact that it (the black box) draws attention to the subscribe box. So I just want to check out the look of the combination of the two.

    It would be great if you can help me with this.

    Thanks Again!
    Greg

    http://wordpress.org/plugins/mailchimp-for-wp/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Greg,

    Sure thing.

    The easiest (and sure-fire) way to do this would be to wrap the form you add to the end of all your posts in another element, so we can then target this element in our CSS selector.

    function mytheme_add_signup_form_to_posts( $content ) {
        if ( is_single() && get_post_type() == 'post' ) {
            $content .= '<div class="end-of-post-optin">'. mc4wp_get_form() . '</div>';
        }
        return $content;
    }
    
    add_filter( 'the_content', 'mytheme_add_signup_form_to_posts' );

    (based on: add MailChimp sign-up form to end of all posts)

    Then, to add a black background to just this form, we can use the following CSS rule.

    .end-of-post-optin .mc4wp-form {
    	background: black;
    	color: white;
    	padding:25px;
    	text-align:center;
    }

    Hope that helps! If you have a quick minute, a plugin review here on WP.org would make me really happy.

    Thread Starter gregsimas

    (@gregsimas)

    Worked perfectly! Thanks Danny.

    How can I get a title to the black box under the single posts only. I want the title to say, “Get Updates! Keep Growing!” in a slightly bigger font then the text. I just don’t want the title in the black box under the post to disturb what I have going on the sidebar. Hope this makes sense.

    Thanks Again!
    Greg

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Greg,

    You can upgrade to MailChimp for WP Pro which lets you create multiple forms. This way, you can create short and more extensive forms or alter the text in the various forms you show throughout your website.

    If you’re not afraid of adding code to your theme its functions.php file, you can also add the title programmatically.

    function mytheme_add_signup_form_to_posts( $content ) {
        if ( is_single() && get_post_type() == 'post' ) {
            $content .= '<div class="end-of-post-optin">';
            $content .= '<h3>Get Updates! Keep Growing!</h3>';
            $content .= mc4wp_get_form();
            $content .= '</div>';
        }
        return $content;
    }
    
    add_filter( 'the_content', 'mytheme_add_signup_form_to_posts' );

    This approach is a little less flexible but I suppose it does the trick. 🙂

    Thread Starter gregsimas

    (@gregsimas)

    Danny,

    I forgot to mention…I wanted the title inside the box right above the paragraph like this.

    http://www.briangardner.com/bleed-all-over-your-blog/ Title: Email Newsletter

    My Title will say: Get Updates! Keep Growing!

    I just don’t want the title in the black box to impact the sidebar at all.

    Hope this makes sense.

    Sorry for the confusion.

    Thanks – Greg

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Greg,

    Yes, I understood. You can do that with the example I showed you or by upgrading to Pro and then creating two different forms, one for the sidebar and one for at the end of your posts.

    Hope that helps!

    Thread Starter gregsimas

    (@gregsimas)

    Danny,

    Oh, ok. Great. I will upgrade to Pro. 🙂

    Thanks Again!
    Greg

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Black Box Under Post, White in Sidebar’ is closed to new replies.