WordPress.org

Ready to get started?Download WordPress

Forums

how'd he do that? (16 posts)

  1. idowens
    Member
    Posted 9 years ago #

    I was looking at http://www.lucky-33.com and I'm wondering how he set his main news column to pull the news & then incorperate that nifty little drop down button w/ comments, author, time posted, etc.....any ideas? Obviously I've tried contacting the owner but to no avail; its been awhile since he's updated that site, so maybe he's awol? Thanks in advance for any ideas/comments/suggestions....
    -Ian

  2. Brak
    Member
    Posted 9 years ago #

    Just some javascripting. He put the info in a div and gave it a DHTML sliding effect onClick.

  3. idowens
    Member
    Posted 9 years ago #

    I understand the 'concept', could you give me some pointers as far as implementation goes? And Thanks!

  4. idowens
    Member
    Posted 9 years ago #

    What I don't understand is how to make the script call for the needed information from wordpress...in otherwords, if I setup a similar JS table for the 'look' (which is the easy part) how do I then tell WP to call for and insert than information?

  5. dss
    Member
    Posted 9 years ago #

    I can relate to what seems like a kind of awe at viewing the index.php and other source files in WP.
    For a long time i posted questions like these and felt kinda weird about the replies i got.
    essentially doing this is easier than you may imagine.
    here's a basic step by step overview:
    1. get (or write) the code for the feature you want.
    2. add it to your index.php
    be it a js call, or a php tag, whatever... just stick it where you want it.
    3. now style it. give it a class of its own, and go nuts.
    this really should be all you need.
    a great example of javascripting in WP is in the show/hide comments hack/plug from scriptygoddess.
    very well documented, and adds a link to the loop, calling js and popping open the comments include.
    a close look at this, and some time well spent and i'll bet you'll get a fantastic result.
    don't forget to come back and show us what you got!
    f.

  6. Brak
    Member
    Posted 9 years ago #

    Do you mean generating the HTML? I'll take a small excerpt from my index.php:
    <h1><?php the_title(); ?></h1>
    <cite>Published <?php $entry_datetime = abs(strtotime($post->post_date)); echo time_since($entry_datetime) ?> ago by <?php the_author() ?></cite>
    <?php the_excerpt(); ?>
    " class="more">read more
    <p class="details"><span class="commentlink"><?php comments_popup_link(__('no comments yet'), __('1 comment'), __('% comments')); ?></span> | posted to <?php the_category(' | ') ?>

    Notice how it's set up differently from the default install? All of those <?php tags are in essense the stuff that WordPress is spitting out. So I could do something like this:
    Expand Details
    <div class="expand">
    Author: <?php the_author() ?>

    Category: <?php the_category() ?>

    </div>
    After some CSS styling and writing my doSomething() function in javascript, I would have the same effect that he's had. Just use the template tags in WordPress to manufacture your HTML.
    I hope that helps a bit...

  7. lucky33
    Member
    Posted 9 years ago #

    sorry, Ian, I assure you I'm not AWOL, been busy lately...to address your question about the dropdowns, Brak was correct...Basically, i just use the general wordpress functions to output the information i want into a div, something like this:
    <ul class="meta" id="postMeta-<?php the_ID(); ?>">
    <li class="first">Written by:&nbsp;<?php the_author(); ?> @ <?php the_time(); ?> on <?php the_time('M j, Y'); ?>

  8. Filed under:&nbsp;<?php the_category(', '); ?>
  9. Viewed:&nbsp;<?php get_post_views($post->ID, is_single()); ?> times
  10. Comments:&nbsp;#comments" title="Comments for <?php the_title(); ?>"><?php comments_number(); ?>

  11. <?php
    if (is_single()) {
    ?>

  12. Previous Post:&nbsp;<?php previous_post("%", "", "yes", "no", 1, ""); ?>
  13. Next Post:&nbsp;<?php next_post("%", "", "yes", "no", 1, ""); ?>

  14. <?php
    }
    ?>
    <?php edit_post_link("Edit This", "
  15. Edit:&nbsp;", "
  16. "); ?>

    then i use some CSS/Javascript to manipulate the CSS display property on that DIV...simple, see? any more questions, let me know...i'll try to be a bit more prompt :)

  • lucky33
    Member
    Posted 9 years ago #

    and by DIV i obviously meant UL...sorry, i should read things a bit better before i write them

  • idowens
    Member
    Posted 9 years ago #

    Dss, brak, and Lucky, thanks so much for your responses...I'm going to play with it a bit and see what I can come up with. One thing I've enjoyed about WP is being able to roll up my sleeves & learn new things (as opposed to choosing a template from 20 or so radio-button choices and it looking...institutional.
    The support I've received on the forums is greatly appreciated. Thanks again!

  • idowens
    Member
    Posted 9 years ago #

    Lucky, in the first line of what you posted, I don't seem to have anything that coincides w/ <?php the_ID(); ?> . Could you explain this part?

  • idowens
    Member
    Posted 9 years ago #

    I'm getting something like this where I have my code inserted: Fatal error: Call to undefined function: the_author() in /home/idowensc/public_html/two/index.php on line 232. I'm not sure how to interpret this (other than, it can't seem to find what its looking for)
    The current test folder i'm working out of is NOT the same folder I have WP installed into on my server. Do I need to define the loc of the WP folder somewhere in the my php?
    Again, thanks for all your help guys.

  • lucky33
    Member
    Posted 9 years ago #

    well, that function, the_ID(), must be within "the loop", as it is known around here...i kinda left that code out, but wherever you see something like foreach ($posts as $post), that is generally the loop where the posts are getting written out...

  • Anonymous
    Unregistered
    Posted 9 years ago #

    "Javascript to manipulate..." I'm such a noob at this, I don't know anything about java-scripts =/
    I would be so happy if you could post the script somewhere so that I can have a look at it.

  • Anonymous
    Unregistered
    Posted 9 years ago #

    can someone help me with that java thing? I've never used java scripts before....

  • amory
    Member
    Posted 9 years ago #

    anon - i'll post up a js file i'm using to expand/contract my comments once i get home.

  • Anonymous
    Unregistered
    Posted 9 years ago #

    thnx!

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.