Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Looking for Suggestions – mySQL and PHP

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #191873
    Jimmy
    Participant

    Hey all, without being too brief, I am building a WordPress site and have designed everything in a way I find visually appealing using HTML and CSS. What i hadn’t thought about was how realistic my design was for the material I will be displaying.

    Let’s say I have a website that acts predominantly like RottenTomatoes.com or a book review site like you might find on a particular landing page at Amazon.com. Using RottenTomatoes as the example, what if I want to be able to show the best movies from the last ten years? I need to be able to efficiently add a block of information which has a small image, the title, brief description and a film review. I also need to be able to easily add movies to the list.

    What i probably would have done, and mistakenly so, is continuously add new movies directly to the particular php file on WordPress. This seems impractical. I have started to think I may need to either become an expert with databases or PHP in order to accomplish something like this in a more efficient manner.

    So with that all being said, I was hoping for suggestions as to particular material which I could read (or view) for inspiration. Or even just to point me in the right direction, because honestly I have spent quite a bit of time googling ideas and searching vigorously through Linda.com in hope of finding a light at the end of the tunnel!

    #191877
    Senff
    Participant

    You shouldn’t really have to look into MySQL and PHP, unless you really want to. WordPress can act like an “interface” between your code and the database. In theory, you can do a lot without ever using any database code (select * from wp_posts where id = 1 and all that) — I never, ever do that kind of stuff.

    Knowledge of PHP is helpful, but you don’t have to be an expert in order to be able to make things with WordPress.

    What you could look into though, in your case, is the WordPress structure, how it handles data/content, how you can display the various types of content, etc. In your specific examples above, I would suggest to check out how custom fields work, and maybe check out the plugin Advanced Custom Fields.

    All in all, I think your problem is not a coding issue, but more a structural one, if you know what I mean.

    #191890
    Alen
    Participant

    @jcsearson

    You can use Custom Post Type in WordPress. I’ll try to walk you trough the process of setting it up and later we’ll add Custom Meta Data using ACF (Advanced Custom Fields) plugin.

    Lets start, see Gist.

    #191901
    Jimmy
    Participant

    Thanks a lot guys, evidently Custom Fields (specifically ACF) is the answer as I have done a brief search around after both of your suggestions.


    @Allen
    I am going to have a look at your Gist immediately when I get settled at home tomorrow morning! I am excited to give it a try and will get back on here soon.

    #192016
    Jimmy
    Participant

    Ok Alen, I am with you thus far. Thank you for for that helpful gist by the way, it was extremely easy to follow.

    Everything went smoothly. What would you suggest in terms of a next step in the right direction with this? I see what your doing but I am definitely on training wheels right now!

    #192674
    Jimmy
    Participant

    Nevermind. Thank you @Alen once again for the Gist. It took me a few days but after reading up on queries in WP I came back to this post and realized you had provided me with everything I needed to know in order to do what I wanted to do. And I have gotten it up and running, making me very happy.

    What I wanted to do was have categories (taxonomies) for all the different movie genres. One example would be on the page template for comedy films that I add to my custom films post type. Within my html, I used the following, with the ID# (6) being the id assigned to that particular category on my wordpress install:

    <?php $films = new WP_Query(array(
        'post_type' => 'films',
        'cat' => '6'
    )); ?>
    
    <?php if ($films->have_posts()) : ?>
    <?php while($films->have_posts()) : $films->the_post(); ?>
    <li>
        <h2><?php the_title(); ?></h2>
        <a href="<?php the_permalink(); ?>">
            <?php the_post_thumbnail( 'full' ); ?>
        </a>
    </li>
    <?php endwhile; ?>
    <?php endif; ?>    
    <?php wp_reset_query(); ?>
    

    Using your Gist as a guide I was able to create my custom post type and figure out how to query those posts in the way I wanted. So thanks again!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.