DarkMage530
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpHmmmmm very interesting. I changed the permalinks to the default and it worked as I expected. I then changed
%post_id%
to%postname%
and again it worked as expected. I tried a couple different variations including%category%/%post_id%
and everything worked as I expected except when I had%post_id%
as last.It certainly sounds like a bug of some kind. Should I file a bugreport for this? Overall it’s a real shame the %post_id% doesn’t work as expected because I liked having short and unique urls.
It does seem to work as
/%post_id%/%category%
but doing anything like this defeats the idea of a hierarchical url and also goes against the warning on the Using Permalinks #Structure Tags article. (Although the posts will still unique urls because the%post_id%
is being used, just not ending with it)And also with a changed permalink structure it is indeed grabbing from the Single.php as I initially expected.
Thank you very much for the help and the quick replies over the past 24 hours. I appreciate it. If at any point I sounded a little snappy or frustrated, I apologize for that.
Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpAll I really want is when I click this link
https://darkmage530.freeiz.com/anime/2013/17It only shows the post with post_id 17
And when I click this link
https://darkmage530.freeiz.com/anime/2013/15I am only shown the post with post_id 15.
Instead both links lead to exactly the same thing. I assumed the issue was because it’s using the category.php template instead of the single.php template. That may be an incorrect assumption.
This should not be something difficult to do and why it’s not default behavior is mind-boggling. Since 99% of the blogs I’ve been to behave the way I described.
Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpThere is no functions.php in my child theme. But there is one inside the imported twentyeleven theme. Which is unchanged from the original.
There are 2 plugins listed but both are inactive.
My permalinks settings are currently
Common Settings: Custom Structure: /%category%/%year%/%post_id%
Category Base: category
Tag Base: tagIf I activate twentytwelve without doing anything else, it appears to act in a similar manner as my child theme. Clicking on a link or a title to go to a particular post displays my 3 posts in the same order as before. The only other noticeable changes are colors, the sidebar I had removed, and my custom
<h1>filename.php</h1>
identifier comments.Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpAh I see, that makes sense.
Sure, https://darkmage530.freeiz.com/
Right now I only have 5 files in my child theme for overriding the twentyeleven theme. That is styles.css, static-home.php, home.php, category.php, and single.php
Clicking that link will load up the static-home.php. Clicking “Recent” on the header will take you to home.php which will show my 3 sample posts. Clicking the third header currently named “My Anime” will take you to a Page where I have added links among other text to my 3 sample posts.
Clicking on the title of one of the posts from “Recent” or one of the links in the “My Anime” Page pulls up the category.php with the 3 sample posts listed in the same order regardless of what the URL is in the browser.
I’ll add the category.php and the single.php code below. I removed some superfluous code on some pages like the sidebar, the else statements from the
if (has_posts)
and other parts of code that was just noise for now.Here is the code for category.php
<?php /** * The template for displaying Category Archive pages. * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ get_header(); ?> <h1>after header CATEGORY.php</h1> <section id="primary"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( 'nav-above' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <h1>the loop CATEGORY.php</h1> <?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentyeleven_content_nav( 'nav-below' ); ?> <?php endif; ?> </div><!-- #content --> </section><!-- #primary --> <h1>before sidebar CATEGORY.php</h1> <?php get_footer(); ?>
and for single.php
<?php /** * The Template for displaying all single posts. * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ get_header(); ?> <h1>after header SINGLE.php</h1> <div id="primary"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <h1>the loop SINGLE.php</h1> <nav id="nav-single"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3> <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span> <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span> </nav><!-- #nav-single --> <?php get_template_part( 'content-single', get_post_format() ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <h1>before footer SINGLE.php</h1> <?php get_footer(); ?>
Like I said most of this is just sample garbage stuff just to learn how to manipulate the themes and templates and figure out what is going on. Thanks again, let me know if you need any more information.
Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpI had the ‘Front Page’ set to HomeStatic and ‘Posts Page’ set to RecentPosts.
I tried renaming the home.php to something different so that it picks up the index.php by default. That didn’t seem to change anything. It still displays the most recent posts as it iterates through the loop. The only difference was that it didn’t have my custom display lines that I’ve been using to identify which templates are being used and where.
as an example:
<h1>the loop Category.php</h1>
I’ve added lines like this to my static-home.php, home.php, category.php, and single.php. When I click the title of a Post I should see just that one post. I would anticipate I’d see the single.php identifier line but I see only the category one.I’m a little confused as to why the home page and static-home page would effect the use between single and category.
Thanks for the continued help
Forum: Fixing WordPress
In reply to: category.php template being used instead of single.phpWell I’m not actually using the Loop on my static front page. Since I’m still just playing around and trying to figure out themes. I’m also not sure why the static front page would effect it. The file is named static-home.php since the How to: for Static Front Page explicitly stated not to call it home.php. Which is what I named the “Recent Posts” page.
static-home.php:
<?php /* Template Name: static-home */ ?> <?php /** * This is my form of a static home for now * It will be updated in the future * @package WordPress * @subpackage Twenty_Eleven */ get_header(); ?> <div id="primary"> <div id="content" role="main"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Static Home Page', 'twentyeleven' ); ?></h1> </header><!-- .entry-header --> <div class="entry-content"> <p><?php _e( 'Testing testing static home testing', 'twentyeleven' ); ?></p> </div><!-- .entry-content --> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
home.php:
<?php /** * @package WordPress * @subpackage Twenty_Eleven */ get_header(); ?> <div id="primary"> <div id="content" role="main"> <?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( 'nav-above' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentyeleven_content_nav( 'nav-below' ); ?> <?php endif; ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
As you can see I’m using the twentyeleven theme as a base and I created a child theme that imports from twentyeleven.