Forums

[resolved] Can you help me?? (51 posts)

  1. Boo_77
    Member
    Posted 3 years ago #

    I'm not sure what it is I am trying to do.

    If you could just visit this site very quickly I'll tell you what I want to do that is the same.

    http://www.dooce.com/

    See how she has a main site where she does her daily writing or posting, but then also has three other "buttons" up the top for daily style, daily chuck and daily photo?? And if you go to each of those pages then you can scroll through the other photo's and such in the daily sections?

    I want to do that but I don't know if I do that by creating a subdomain or a subfolder? Do you know which I would be best doing and if yes, can you please lead me in the right direction so I can learn how to do that?

    Or can you tell me the difference between the two?? What would you use a subdomain for and what would you use a subfolder for??

    Which has she used?

    Thanks heaps.

    Boo

    http://discoverboo.com

  2. tugbucket
    Member
    Posted 3 years ago #

    Well for starters let's talk about what the difference between subdomains and subfolders are.

    Subdomain would be http://subdomin.discoverboo.com
    Subfolder would be http://discoverboo.com/subfolder

    Since your using WP you could make a category called "daily-photo". The link up top would just be the permalink to the most recent post in that category.

    then you can write something like this:

    <?php
    query_posts("category_name=daily-photo&posts_per_page=1");
    while(have_posts()) { the_post();
    echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . "\n";
    }
    ?>

    Granted you'll want to remove "get_the_title" and replace it with an image link if your going to make it look like Dooce but you could just make it a text link as well.

    On the pagination, WP already has that set up anyway, you just need to tell that page to only show 1 post then show the pagination.

  3. Boo_77
    Member
    Posted 3 years ago #

    So I take it that subfolder or suvdirectories would be the way to go for me???

    I am trying to work through your instructions (newby here) and was wondering which page I need to put the code in to??

    I've never used permalinks and don't really understand them yet.

    I guess what I would really like is that if I could have the pages up top (home, about, video's) and have individual posts within those pages. We recently started photography classes and would like to display our photo's in the same way that Dooce does.

    Am I heading in the wrong direction for acheiving something like that.

    I am sorry, you may have already asnwered my question. But I am just getting in to this so it's hard when you know what you want it to look like but don't know what to do to get that. Is there some other reading I could do to learn more about what I want?? Or what I need to do?

    Boo

  4. tugbucket
    Member
    Posted 3 years ago #

    Nah you don't really need to use subfolders for this since you are using WP.

    Where you are calling your navigation (depending on your theme this could be in header.php, sidebar.php or another file) you can replace the basic navigation with something along these lines:

    <ul id="navigation">
    <li><a href="index.php">Home</a></li>
    <?php wp_list_pages('title_li='); ?>
    <?php
    query_posts("category_name=daily-photo&posts_per_page=1");
    while(have_posts()) { the_post();
    echo '<li><a href="' . get_permalink() . '">Daily Photo</a></li>' . "\n";
    }
    ?>
    </ul>

    This will output something like so:

    • Home
    • About
    • Daily Photo

    So the navigation will now be a mix of pages and posts.

    The line: <?php wp_list_pages('title_li='); ?> will take all your pages and make them links inside a list item. The query posts line will query the category "daily-photo" and create a link inside a list item that links to the most recent post in that category.

    Now that "daily photo" link, being actually linking to a category, will link to the first post of said category.

    Then in your single.php file you can add this to the bottom but inside the loop:

    <?php if (in_category('daily-photo')) { ?>
    		<div class="navigation">
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?>
    <br />
    <?php next_post_link('%link', 'Next in category', TRUE); ?>
    		</div>
    <?php }; ?>

    What this will do is check the category name. If it is "daily-photo", it will then add the previous and next links as needed thus acting like the "daily photo" page on Dooce.com. It will only display the links if the post your viewing is in the category "daily-photo".

    Kind of making sense?

  5. Boo_77
    Member
    Posted 3 years ago #

    It is making sense and I thank you for you time and effort.

    It will take me the night (seriously) but I will work with your instructions and try to figure it out.

    I might be back tomorrow :)

    Thanks again for your time. I do appreciate it! And I'll let you know when I have it all figured out!

    Boo

  6. Boo_77
    Member
    Posted 3 years ago #

    So I just spent a little while searching for this navigation thing you're talking about. Remembering that this is all writen in chinese to beginner's and so every word you mention is a lesson within the lesson.

    I looked through all of my pages and the only place I could find the word navigation was in my comments.php. I even went as far as copying the files for the theme to a different folder on my desk top and changing them all to txt files so I could use the computer search function. Navigation came up in the comments.php and also the style.css (though this was just formatting)

    That couldn't be right could it??

    My theme is elegant grunge.

    And I am really sorry to be bothering you!

  7. Boo_77
    Member
    Posted 3 years ago #

    But I did find this...maybe this is it??

  8. Boo_77
    Member
    Posted 3 years ago #

    Oh I'm sorry! What a pain in the bum I am being!

    I took a leap of faith and threw your code in to my header.php and my single.php and I think it has worked.

    But now am having trouble with the permalinks. I think thats why my home page has now become my trial daily photo thing.

    My two options in the permalink section that need to be filled in are catagory base and tage base.

    I don't know what those are.

  9. tugbucket
    Member
    Posted 3 years ago #

    I was using navigation as a sample ID so sorry for any confusion. Every pre-made theme is going to be structured a little different. I downloaded the elegant grunge files.

    Another note is tha I didn't fully test that loop to make sure it was not going to flake out but, I think I got it this time around.

    In the header.php find this line:

    <div id="menu">
    	<ul>
    		<li class="page_item <?php if ( is_home() ) { ?>current_page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'elegant-grunge') ?></a></li>
    		<?php wp_list_pages('title_li=&depth=1'); ?>
    	</ul>
    	<div class="clear"></div>
    </div>

    that you can change to:

    <div id="menu">
    	<ul>
    		<li class="page_item <?php if ( is_home() ) { ?>current_page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'elegant-grunge') ?></a></li>
    		<?php wp_list_pages('title_li=&depth=1'); ?>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&category_name=daily-photo');
     foreach($myposts as $post) :
     setup_postdata($post);
     ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark">Daily Photo</a></li>
     <?php endforeach; ?>
    	</ul>
    	<div class="clear"></div>
    </div>

    That should resolve the issue with your home pagebecoming the Daily Photo page. I was actually querying the post and printing the content which was wrong. Sorry for the mix-up.

  10. Boo_77
    Member
    Posted 3 years ago #

    I've done that and it seems to have worked.

    Should I still put the other code in to the single.php??

    And I see that it has worked. My home page or front page has my about pages and home and video's as well as the daily photo's. Is there a way to format that daily photo's so that it fit's in with the other page titles??

    Also, there was something I had to do in permalinks. I am not too sure about what it wants in that regard. They ask for a catagory base and a tag base. I thought this would have been the catagory base (http://discoverboo.com/2008/01/13/dude-two/) but I was wrong I think. It didn't work.

    Thank you so much for helping me so much. Can I just say I don't think anyone has ever been so helpful here since I joined? Thank you!

    I am just about to go to bed and so just about to remove this from the site until I get up to work on it again tomorrow. Thanks again!!

  11. Boo_77
    Member
    Posted 3 years ago #

    Oh bugger. Can you see what I have done??

  12. tugbucket
    Member
    Posted 3 years ago #

    Leave the Category Base and Tag Base blank like it is in the default install.

    now it's making your categories all have the same base of "daily-photo" like:

    http://discoverboo.com/http:/discoverboo.com/daily_photo/jaxon/

    that's bizarre. no need for it and with the two http: in there, I'm surprised it still works at all.

    Yes, the code for the single.php is the previous and next links for the "daily-photo" category. Do remember though, any post you make for this category, don't include it in any other category as the previous/next buttons will then start to cross reference and not yield the desired result.

    Another note is that all this is going to also populate a link in your category drop down for the "daily-photo" category. When that link is clicked, that page will act just like any other archive for any other category. If you don't want that to happen and for the link to this category to be only accessible through the main navigation link, you're going to need to exclude this category from the loop you are running to populate the drop down box.

    Hope this all works. We're about 8 hours apart so we'll see.

  13. Boo_77
    Member
    Posted 3 years ago #

    OK, here goes.

    I have changed the two lot's of code you gave me and it's working I think.

    I'm sorry but I still have a few questions :)

    I've changed the daily photo title to just photo, lest I be copying Dooce, which is not my intention. I only changed the word daily photo to photo in this part of the code...

  14. " rel="bookmark">Photos
  15. Is that going to affect it in any way I should I do more?

    Then, how can I make it so that the link for the Photo's appears as a page title similar to the others (home, about and videos) Where they are all white and lower on the page and the Photo's link is much higher and purple.

    Also, if you click on the photo's link it takes you to my test photo of our cat. I put up two test photo's of him and it only takes me to the first. How do I make it so that it wil scroll through those photo's from the first page.

    I don't mind if it's in the drop down catagory as well. But what I do want is so that I don't actually have to post those photo's on the home page. That people wishing to see the photo's will have to click on that link to do so. Does that make sense? How do I post these photo's without actually having to blog them?

    Am I heading in the right direction now? LOL I feel like such a dweeb with my lack of knowledge!

    Ahh, once again. Thank you for your time. I would be stuck in limbo land without your help!

    Boo

  • Boo_77
    Member
    Posted 3 years ago #

    See I am not sure if this is because it's not set up properly yet or if this is just not what I want it to look like.

    I just posted some new photo's under the daily photo section and they've come up on the front page as a normal post.

    I don't want them to be a part of the blog. More of a feature of the blog. Something I can upload for family to see, but that they need to click the photo page (or button) at the top to see them.

    And if they don't want to see them, they don't click on it.

    Are we heading in the right direction for that kind of thing?

  • Boo_77
    Member
    Posted 3 years ago #

    I'm like your mini stalker!

    Would this help me??

    http://aralbalkan.com/wordpress

  • tugbucket
    Member
    Posted 3 years ago #

    Not sure about that plugin. You can try it, but as I try to physically man-handle the code, I don't use a lot of plugins ;)

    I didnt notice the class name on the menu, sorry again. Make the code look like this:

    <div id="menu">
    	<ul>
    		<li class="page_item <?php if ( is_home() ) { ?>current_page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'elegant-grunge') ?></a></li>
    		<?php wp_list_pages('title_li=&depth=1'); ?>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&category_name=daily-photo');
     foreach($myposts as $post) :
     setup_postdata($post);
     ?>
    <li class="page_item"><a href="<?php the_permalink() ?>" rel="bookmark">Daily Photo</a></li>
     <?php endforeach; ?>
    	</ul>
    	<div class="clear"></div>
    </div>

    We need to make the LI have a class of "page_item" and this will do it.

    To exclude the category from the home page you can open the themes functions.php and add this to it:

    function exclude_category($query) {
    	if ( $query->is_feed || $query->is_home ) {
    		$query->set('cat', '-3');
    	}
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');

    You will need to change the "3" to be the ID of the category you want to exclude. So in your admin panel go to manage > categories and hover over the category and in the status bar at the bottom it will say ID=something. That will show you the Category ID#.

    If you've never messed with the functions.php file, add this line after the opening <?php in that file or it will throw an error.

    Sorry this is so much of a back and forth. I've never done what you're trying to do so it's a learning experience for both of us ;)

  • tugbucket
    Member
    Posted 3 years ago #

    oops, double post

  • Boo_77
    Member
    Posted 3 years ago #

    ok I'll do that now and see what happens.

    Can you see whats going on there at the moment?? I have installed the two plugins (coz I haven't got a clue about the code!) one is the inline one, which is apparently making it so I can have posts within pages. And the other is called ultimate catagory excluder. Thats made it so those photo posts don't show up on my home page.

    I don't know if you noticed that the two posts I have on that photo album page have the same photo's in them? Well in the ACTUAL posts they have different photo's so I don't know why thats happening. Any clues?? I thought maybe it has something more to do with the the gallery settings than what I am messing about with plugins.

    Anyway, I am here and I am just about to do your last suggestions so bare with me (it's 12.10am!)

  • tugbucket
    Member
    Posted 3 years ago #

    I'm not sure about those pugins. Like I said, I usually don't use them so I wo't be much help on that part.

    It does look like the menu is working fine now though.

  • Boo_77
    Member
    Posted 3 years ago #

    Ugg!! I hate that I am going to have to go to bed!

    I got all excited then that we may have got it but it turns out I was on the home page.

    So I love that the Daily Photo now looks the same as the other pages. Thats great. Thank you.

    But if I wanted to call it "Photo Album" how would I go about that (dooce' daily photo was just an example of the way I invisioned it being set up) I did try to go through and just change every daily photo in to Photo Album but then the entire site didn't load so I must have done something wrong.

    Then I noticed that I have two of the "daily photo" tags set up with two different photo's of Dude on them and only one is showing up. It doesn't have a "previous entry" or "next entry" button to click on either. Is this something we have addressed already and I have gotten wrong??

    I changed that catagory ID number too by the way. It was 28. Does the dash stay?? You had -3. Does it become -28 or just 28.

    I think we're getting there and I appreciate you sticking around and not getting upset that this is taking so long and I have so many questions and am being needy :)

    I'll be off to bed soon.

    Thanks

    Boo

  • Boo_77
    Member
    Posted 3 years ago #

    You know what? I think we're nearly there!

    All I need now is to make it so that people can scroll through the photo album catagory from that page, and so that the photo album posts don't show up on my home page.

    I had catagory exclusion (plugin) working before but I think with that new code it's stopped. Any suggestions?

  • tugbucket
    Member
    Posted 3 years ago #

    It really doesn't matter if you call the category "daily photo" , "photo album" or "bananas" for that matter. What matters is that you 1) have those posts in only that category and 2) that in this line: $myposts = get_posts('numberposts=1&category_name=daily-photo'); you change "daily photo" to be the right name as well as in this line: <?php if (in_category('daily-photo')) { ?> of the pagination script.

    The previous and next links are in the code:

    <?php if (in_category('daily-photo')) { ?>
    		<div class="navigation">
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?>
    <br />
    <?php next_post_link('%link', 'Next in category', TRUE); ?>
    		</div>
    <?php }; ?>

    which needs to be inside the loop and on the single.php.

    On the "-' issue, yes you need the dash. It's basically saying show post minus category 28 in your case. That's how it excludes a category.

    I know this is a lot to digest.

  • Boo_77
    Member
    Posted 3 years ago #

    I must be doing something wrong in the single.php file.

    What exactly does it mean to be inside the loop??

    I assumed that it just meant it had to be after the start and before the end. Maybe I am wrong. I already had that code in there.

  • tugbucket
    Member
    Posted 3 years ago #

    In the single.php you'll see this line near the bottom of the page: <?php endwhile; else: ?> that script needs to be above that line in the code.

    That line is the end of the "if have posts" so at that line it stops. Since the script in reliant on that statement it needs to be inside it.

  • Boo_77
    Member
    Posted 3 years ago #

    OK I really have to go to bed!!

    I did that. But I don't think it worked?? I don't know. My eyes are glazing over at this point.

    </div>
    			<div class="hr"><hr /></div>
    
    	<?php comments_template(); ?>
    
    <?php if (in_category('Photo-Album')) { ?>
    		<div class="navigation">
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?>
    <br />
    <?php next_post_link('%link', 'Next in category', TRUE); ?>
    		</div>
    <?php }; ?>
    
    	<?php endwhile; else: ?>

    Thats what I put.

    I think we're almost there. I am sorry it's taken so long. But it's hard when you're a beginner. I'll leave it for the night now and hope that you're not so sick of me tomorrow that we can try once more to nut it out. Thanks for sticking around...you're a saint!

    Boo

    (nite nite)

  • Boo_77
    Member
    Posted 3 years ago #

    Good Morning!!

    So I thought we could sort of start from scratch so that we both know what I have done.

    Here is what I put in the header.php

    <div id="page">
    
    <div id="menu">
    	<ul>
    		<li class="page_item <?php if ( is_home() ) { ?>current_page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'elegant-grunge') ?></a></li>
    		<?php wp_list_pages('title_li=&depth=1'); ?>
    <?php
     global $post;
     $myposts = get_posts('numberposts=1&category_name=photo-album');
     foreach($myposts as $post) :
     setup_postdata($post);
     ?>
    <li class="page_item"><a href="<?php the_permalink() ?>" rel="bookmark">Photo Album</a></li>
     <?php endforeach; ?>
    	</ul>
    	<div class="clear"></div>
    </div>
    
    <div id="header-wrap">

    Here is what I put in single.php

    <?php comments_template(); ?>
    
    <?php if (in_category('Photo-Album')) { ?>
    		<div class="navigation">
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?>
    <br />
    <?php next_post_link('%link', 'Next in category', TRUE); ?>
    		</div>
    <?php }; ?>
    
    	<?php endwhile; else: ?>

    Here is what I have put in functions.php

    <?php
    
    function exclude_category($query) {
    	if ( $query->is_feed || $query->is_home ) {
    		$query->set('cat', '-29');
    	}
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');
    
    define("ELEGANT_GRUNGE_FRAME_MAX_WIDTH", 415);

    Oh. Maybe I am missing something. You've mentioned it a couple times, the pagination script. Is that page.php?? I haven't learnt about pagination yet! No, single.php must be where you're referring to!?

    Am I missing a step here for it to not be working right on the pages??

    Thanks

  • tugbucket
    Member
    Posted 3 years ago #

    okay that's just weird. I'm doing all kinds of tests on my end and don't see a reason for it not to be working.

    Can you email me your whole single.php file? alan[at]tugbucket .net

    I'll load it up and give it a go.

  • tugbucket
    Member
    Posted 3 years ago #

    Boo,

    I think I got it. Go to manage -> categories. Is your Photo Gallery category name "Photo Gallery" or "Photo-Gallery"? Notice the difference between a space or a hyphen. When WordPress checks this request, it is looking for the name you created for the category. So if there is a space and not a hyphen, it needs the space.

    I have a category name HTML/CSS, when I list categories WP changes that to htmlcss. When I try to call this request using htmlcss it fails. When i use the name I created eg. "HTML/CSS" it works. thats the only way I could get it to fail.

    So assuming your category was created as "Photo Gallery" then use this code and see if it works now:

    <?php if (in_category('photo gallery')) { ?>
    <div class="pagenavigation">
    <?php previous_post_link('%link', 'Previous in category', TRUE); ?>
    <br />
    <?php next_post_link('%link', 'Next in category', TRUE); ?> 		</div>
    <?php }; ?>

    another thing. Notice I changed the class name to "pagenavigation". I looked at your CSS and there is already a class called "navigation" I think that is the default nav but not sure. Don't want to have any conflicting styles running rampant.

  • Boo_77
    Member
    Posted 3 years ago #

    Did you see that?? I think we can put this out of the way now! You did it...you did it! YAY!

    Now, just one more thing. Can we remove the side bars from that page??

  • Boo_77
    Member
    Posted 3 years ago #

    Also, if I wanted to do another kind of page...or do this same thing with my video's page, would that work?? Would I just change the details of the code you've already given me and add it again?

    And if I wanted these new pages to show up in my "pages" part in the second side bar...is that possible??

  • 12

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags