• Resolved mossbit

    (@mossbit)


    I am not sure how to do this php coding. I am working on our club site here is the original website
    wacweb.org
    I am recreating this site in WordPress Twenty Twelve using a child theme the new website is located here
    mysite
    How some of it works
    A login member can write a post. Once the post is approved the mountain they wrote about will be add to the mountain pages and a number will be added to the mountain notifying others the number of post of that mountain. So if Mt. Reinier has 3 posts the number 3 will be next to it and I can click on the number and it will take me to the post.
    I do not want the members to edit the mountains like before so I made them into pages, but I do want the posts about the mountains to be added to the individual mountain.
    Question
    1) How do I add a number to the mountain page if a post is written about it?
    2) On the mountain pages can I condense them (under trip report) where they would go into the database. I create one page instead of 7 would that be better?
    with that said not sure how to do this or if I can do this. Can you help me figure out where to begin. thanks mossbit

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mossbit

    (@mossbit)

    Well it has taken me a couple of days to figure this out. What I believe I need to do is create a post for each and every mountain and place them in a mountain category. I can then create 3 loops. One that sorts the mountains the second adds a mountain to the category the third adds a number to the mountain post if it is there. I think the code will look something like this ( I do not have all of the pieces yet):

    <!-- Start the Loop. -->
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
     <?php if ( in_category('3') ) { ?>
               <!-- Add a number to the mountain post. -->
     <?php } else { ?>
              <!-- If not in mountain post add the mountain to the category. -->
     <?php } ?>
    
     <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
     <!-- How do I sort by mountain by altitude? Can I start the title with the altitude and sort by title?. -->
     by <?php the_title() ?>
    
     <div class="entry">
       <?php the_content(); ?>
     </div>
    
     <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
     </div> <!-- closes the first div box -->
    
     <?php endwhile; else: ?>
     <?php endif; ?>

    Can anyone see if I am still headed in the right direction Thanks so much

    Hi mossbit – have you looked at something like this:

    https://www.ads-software.com/extend/plugins/pods/

    Thread Starter mossbit

    (@mossbit)

    Thanks Wpyogi,
    I looked into this plugin and I think this will do the trick.
    I know what I want to do is complicated. I wanted to create my site with the least amount of plugins. When I first started this project some folks said to use the least amount of plugins because they will slow down the site, but as a beginner in WordPress this plugin will have to do until I can get up to speed with PHP

    Thanks again for you immediate response ??

    I’d agree that being smart with using plugins is good practice – and it’s true that some can be problematic. But on the other hand, no sense in reinventing the wheel :)! From what I’ve heard, that plugin is super – and it clearly has excellent support from the developer! So hopefully it will do what you want and make your coding life a bit easier.

    Thread Starter mossbit

    (@mossbit)

    I want to thank you again for your time and effort. you’re right this is a good plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twenty Twelve php Coding Help’ is closed to new replies.