WordPress.org

Ready to get started?Download WordPress

Forums

Opening Thickbox iFrame from Comments link (5 posts)

  1. ericcarl
    Member
    Posted 4 years ago #

    I'm putting together a theme, viewable here:

    http://www.secretmountain.org/

    For my needs, each post is just one block on the page. I don't have a need for an individual post page, but I do have a need for comments. So my idea is to use a single.php page that only contains the code for Comments, and have that page open up in a Thickbox iFrame. This way viewing a post's comments and adding a comment occurs in a modal window.

    While I have Thickbox working in my theme (viewable by clicking the image thumbnails) I don't know how to get the Comments links to activate it. Normally you have to append the HREF url with something like the following:

    ?height=300&width=300&inlineId=myOnPageContent

    But using the WordPress php comments_popup_link doesn't give me the ability to do this. Any idea what I would need to do to make this work? Thanks!

  2. ericcarl
    Member
    Posted 4 years ago #

    Oh yes, and I'll also need a class of "thickbox" added to the anchor tag. No idea how to make that happen. =\

  3. pineconez
    Member
    Posted 4 years ago #

    I'm a little bit closer to getting this, and I realize this was posted 9 months ago... But I am stuck too.

    using <?php comments_popup_link(); ?>, I am able to get the thickbox to show up, but it also gives the actual popup... So you now got two places to comment. Whats more, is the thickbox comment area doesnt actually post the comment.

    <?php comments_popup_link('comment.', '1 comment', '% comments', 'thickbox', 'comments off.'); ?>

    Can anbody help with this? I am sure there is someone out there who cant stand the way the whole page reloads whenever somoene wants to add a comment... I'd be happy with an ajax method (similar to "read more right here" plugin), thickbox, whatever. Just something to keep users from having to reload the whole page to see/make comments.

    Anyone?

  4. pineconez
    Member
    Posted 4 years ago #

    Here's a theme I just found that does what I'd like to do, but it seems like they had to add a lot of their own java and things like that to make it work, honestly I wouldn't know what to take from it to make it work on my own site, because it is so unlike any theme I've played with.

    http://wordpress.org/extend/themes/p2

  5. pineconez
    Member
    Posted 4 years ago #

    Alright, I figured it out for anyone in the future who might have this same problem.

    First, Get and install the Shadowbox plugin. This is much better than thickbox, and runs the same way.

    now it is as simple as adding this code:

    <div id="comments<?php echo $post->ID ?>" style="display:none">
     <!-- all the php making up the comments section -->
    </div>
    
    <a href="#comments<?php echo $post->ID ?>" rel="shadowbox">Add a comment.</a>

    ps. make sure you got enableKeys:false set up in the settings section of the plugin, otherwise the space bar wont work in text fields.

    pps. I just took the parts of the comments.php file that I wanted and put them in the section I have labeled in the code above (which was pretty much all of it).

    peace n blessings
    hope this helps someone

Topic Closed

This topic has been closed to new replies.

About this Topic