WordPress.org

Ready to get started?Download WordPress

Forums

Help with coding a new segment (9 posts)

  1. Daven
    Member
    Posted 4 years ago #

    Okay, I'm using the WP Framework theme and I'm trying to add a "segment" to the "puzzle" that is WordPress.

    Basically, I have a section under the content of both Posts and Pages where I have things like this:

    Share this
    Tweet this
    Print This

    and so on that is added by various plugins. What I want to do is to make them go into a new "section" that will have them being inline, instead of all down one side, like this:

    Share this Tweet This Print This

    I figure the easiest way to do this is to create a new grouping (call it "downunder") and have the plugins put it into that framework. Then I can tweak it to my hearts content to look as I want. I only have to add one line of code to the template files < php get "downunder" > like it does with the footer and header sections.

    My problem is this: I know very little PHP code. Is there someplace that I can find a tutorial, a step by step, a guide or something so I can do this? I can probably modify the code enough to get it to work, and I'm sure I can find coding references online to help me along, but I need to know where to start.

    Anyone willing to help me with this will have my undying gratitude.

  2. Peter Boosten
    Member
    Posted 4 years ago #

    These plugins mostly embed their output in some class, which you can make 'float: left;'. Then they will line-up.

    But to be absolutely sure, an URL to your site would be needed.

    Peter

  3. Daven
    Member
    Posted 4 years ago #

    Sorry, the test site is at http://davensjournal.com/Updating/

  4. Daven
    Member
    Posted 4 years ago #

    bump

  5. Peter Boosten
    Member
    Posted 4 years ago #

    ACK :-)

    I can only see a 'tweet this' link, but no print/share. Did you remove/not add yet the other ones?

    Peter

  6. Daven
    Member
    Posted 4 years ago #

    The print is on the right, the share is just above the tweetthis graphic. I've got them all on there.

  7. Daven
    Member
    Posted 4 years ago #

    Okay, I see what's going on...

    Go into one of the posts. The print is there. The share is just below my sig.

    Then there's the related posts too.

  8. Peter Boosten
    Member
    Posted 4 years ago #

    Oke, I need to know beforehand: did you code anything in your single.php/page.php for these plugins, or do they work 'out of the box' in your theme?

    If the latter is the case, then you will have a nice challenge to get it right.

    Ideally you want to have some control over the placements of their output, but if a plugin hooks into the_content() by itself, then it will just be underneath the post, with some classes/id's the writer of the plugin finds appropriate. And that's not the way you want it to behave.

    To get it right, you would have to write something like this (this is hypothetical):

    <div class="pluginstuff">
      <span class="plugin"><?php the_sharethis_function(); ?></span>
      <span class="plugin"><?php the_twitter_function(); ?></span>
      <span class="plugin"><?php the_print_function(); ?></span>
    </div>
    <div class="clear"></div>

    (the spans could be list items, embedded in an unordered list)

    and its css:

    .plugin {
      float: left;
      margin-right: 10px;
    }

    but to do so, it would require you to unregister the filter hooks of the plugins.

    Not impossible, but I doubt you'll find a step-by-step tutorial for doing so.

    Peter

  9. Daven
    Member
    Posted 4 years ago #

    The only tweak I made to it was to put a < div > around the Print stuff and put it on the right.

Topic Closed

This topic has been closed to new replies.

About this Topic