• Resolved Boo_77

    (@boo_77)


    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.

    https://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

    https://discoverboo.com

Viewing 15 replies - 1 through 15 (of 50 total)
  • Well for starters let’s talk about what the difference between subdomains and subfolders are.

    Subdomain would be https://subdomin.discoverboo.com
    Subfolder would be https://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.

    Thread Starter Boo_77

    (@boo_77)

    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

    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?

    Thread Starter Boo_77

    (@boo_77)

    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

    Thread Starter Boo_77

    (@boo_77)

    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!

    Thread Starter Boo_77

    (@boo_77)

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

    Thread Starter Boo_77

    (@boo_77)

    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.

    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.

    Thread Starter Boo_77

    (@boo_77)

    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 (https://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!!

    Thread Starter Boo_77

    (@boo_77)

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

    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:

    https://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.

    Thread Starter Boo_77

    (@boo_77)

    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…

    • ” rel=”bookmark”>Photos
    • 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

    Thread Starter Boo_77

    (@boo_77)

    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?

    Thread Starter Boo_77

    (@boo_77)

    I’m like your mini stalker!

    Would this help me??

    https://aralbalkan.com/wordpress

    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 ??

Viewing 15 replies - 1 through 15 (of 50 total)
  • The topic ‘Can you help me??’ is closed to new replies.