• Resolved Lokesh-

    (@lokesh-)


    Hello,

    I’m currently making my first custom theme from scratch, and I’m having difficulty with the sidebar. I want the categories widget to behave the same way it would in the Twenty Eleven, but on a page other than the homepage. When a user clicks a category it shows only posts that are in that category.

    With my current theme if a user clicks a category link it redirects the user back to the homepage. I’m not sure how to go about fixing this.

    In my functions.php file I have…

    <?php
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    	'name' => 'sidebar',
    	'before_widget' => '<div class="sidebar-box">',
    	'after_widget' => '</div>',
    	'before_title' => '<span class="sidebar-title">',
    	'after_title' => '</span><div class="dots"></div>',
    ));
    ?>

    In the template file for the page I want the sidebar on I have…

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("sidebar") ) : ?>
    <?php endif; ?>

    Also, I do not have any of this online at the moment, so I don’t have a site to link to. I’m using MAMP to work on this locally.

    Thanks in advance,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Ok, what is the output in the sidebar?

    Thread Starter Lokesh-

    (@lokesh-)

    Thank you for the quick reply

    <div class="sidebar-box"><span class="sidebar-title">Categories</span><div class="dots"></div>
    	<ul>
    		<li class="cat-item cat-item-6"><a href="https://localhost:8888/wordpress/category/appliances/" title="View all posts filed under Appliances">Appliances</a>
    			<ul class="children">
    				<li class="cat-item cat-item-7"><a href="https://localhost:8888/wordpress/category/appliances/admiral/" title="View all posts filed under Admiral">Admiral</a></li>
    				<li class="cat-item cat-item-8"><a href="https://localhost:8888/wordpress/category/appliances/bendix/" title="View all posts filed under Bendix">Bendix</a></li>
    				<li class="cat-item cat-item-9"><a href="https://localhost:8888/wordpress/category/appliances/deep-freeze/" title="View all posts filed under Deep Freeze">Deep Freeze</a></li>
    				<li class="cat-item cat-item-10"><a href="https://localhost:8888/wordpress/category/appliances/frigidaire/" title="View all posts filed under Frigidaire">Frigidaire</a></li>
    			</ul>
    		</li>
    	</ul>
    </div>

    Other links work throughout the site?

    Thread Starter Lokesh-

    (@lokesh-)

    Yes, but the only other links are also just in my main menu, and link to pages if that matters. I don’t have any other links that link to specific posts or categories.

    Would it be a problem with the loop?

    <div class="posts">
    	<?php
    	$myposts = get_posts('');
    	foreach($myposts as $post) :
    	setup_postdata($post);
    	?>
    	<div id="postbg">
    		<div id="postContent">
    			<?php the_content(); ?>
    		</div>
    	</div>
    	<?php endforeach; wp_reset_postdata(); ?>
    </div>
    Thread Starter Lokesh-

    (@lokesh-)

    I think it might be a problem with my permalinks. I tried changing them to default and it didn’t make a difference, so I read that it might be a problem with the .htaccess file that wordpress will generate when you change permalink settings. I don’t have that file though so I couldn’t delete it or make changes to it.

    As far as viewing individual posts the best that I can do is click the view post links in wp-admin, and that will load a blank page. Otherwise all I can see is what the loop I posted previously displays.

    Any other things I should be looking into, or a major step I could of missed when it comes to making posts viewable?

    Thanks in advance,

    Thread Starter Lokesh-

    (@lokesh-)

    Woot! I figured out what I was missing. I missed the very critical step of creating an archive.php file.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Categories widget sending users to homepage in custom theme’ is closed to new replies.