Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool How to present the database info?

    Firstly let me say that I don't really know anything about PHP or web development but I've been tasked by my brother in law to put together a website for a small magazine that he is starting. I built the main site in HTML and CSS and I decided to use Wordpress as a CMS system. On each relevant page of the website I have inserted the following code:


    <?php
    require('wordpress/wp-blog-header.php');
    ?>

    <?php
    query_posts('category_name=sport');
    ?>
    <?php while (have_posts()) : the_post(); ?>

    <?php echo "<br />"; ?>

    <h1>
    <?php the_title(); ?>
    </h1>

    <p>
    <?php the_content(); ?>
    </p>

    <?php endwhile; ?>



    This works great to bring in the content I want on that page using categories to define where it ends up. The problem is that as soon as I have a few posts the page gets very long. So what I would like to do is show just the image and first paragraph of the first 8 posts with a little "...more" link which when clicked will display the full post.

    I would also like to add "next" and "previous" at the bottom of the page so older posts are still accessible to browse through.

    If anyone would be able to help me with this I would be eternally grateful!

    Thank you in advance and let me know if you need more info... As I mentioned I don't really know what I'm doing here!

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Um... this is one of the most basic pages of a wordpress theme. There are dozens of tutorials on how to make a wordpress theme, and you can read the code of the theme that comes packed with wordpress to do what you want. Just google it.

  • #3
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's great thank you! Sorry if it was a very obvious question but as I said I am a beginner so not sure what I'm doing!

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Being a beginner is fine, but you also do need to put in some effort yourself. Its clear you took some time to figure out how a wordpress page is setup, so I'm confused why you didn't go all the way and read the code on the core themes.

    That being said, this forum is more about answering specific questions, and you'll get a lot better responses when you show you've put in some effort and have come to a block.

  • #5
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The main issue as a beginner is that there is often a huge amount of code in the themes which is not relevant to the tasks needed. It can be very difficult to strip something down to just the code that you want when you don't actually understand what is relevant.
    That said, on your recommendation I have now managed to find a very stripped down theme which I hope will allow me to figure out the bits I need.

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by bbackhouse View Post
    The main issue as a beginner is that there is often a huge amount of code in the themes which is not relevant to the tasks needed. It can be very difficult to strip something down to just the code that you want when you don't actually understand what is relevant.
    That said, on your recommendation I have now managed to find a very stripped down theme which I hope will allow me to figure out the bits I need.

    You have a very good point; sorry if I was a bit short.

    That being said, there are a number of very good tutorials on how to build wordpress themes.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •