• Resolved prodromoi

    (@prodromoi)


    Hi.

    I’m a relative newbie to WordPress, so this might be a really simple question, but I simply can’t work out the answer…

    The theme that I’m using is Galactica from WordPress Templates:
    https://www.wordpresstemplates.com/galactica/

    I’ve added three pages as tabs, but at the bottom of each of them it states:
    “Posted under Uncategorized”

    …and I can’t see anywhere how to assign individual categories to each of these pages, either at the time of creating the page or subsequently.

    Here’s a link to one of them as an example:
    https://www.outsider.org.uk/blog/?page_id=2

    Thanks in advance,
    Alex

Viewing 10 replies - 1 through 10 (of 10 total)
  • They’re added to Uncategorized because that’s the default category. In the admin area go to Post – Categories and change the name of that category to something you like better.

    Thread Starter prodromoi

    (@prodromoi)

    Thanks for that, but that’s not what I’m asking about – I can see where I should have made it clearer… (I’ve now edited the first post for clarity.)

    How do I assign specific, different categories to each of these extra tabbed pages?

    AFAIK you can’t assign categories or tags to pages. You’d be better off changing your theme to show this Posted under [...] text only below posts, i.e. add an if statement checking for is_single around this text. Maybe you want to read more about Conditional Tags as well.

    Thread Starter prodromoi

    (@prodromoi)

    OK, I’ll give that a try, thanks. (Although my head is aching looking at the code required!)

    Getting rid of the inclusion of a category field for these pages would work if I can’t give them specific categories…

    Will update if I can work it out…

    If you can’t manage to make this work just let us know…

    Thread Starter prodromoi

    (@prodromoi)

    I presume it’s the page.php file that needs this section of code added?

    At the moment I can’t even edit that page at all (via the admin’s editor), since selecting it under Appearance/Edit Themes is giving me only a dark grey code box with text of almost the same shade of grey which I can’t even highlight or edit… (But I can get round that by editing an offline copy and then uploading it.)

    Looking at the Conditional Tags page and the is_single condition, I can’t find a example that’s basic enough for me to understand the syntax of the IF check that I need to construct or where to fit it into the existing page code.

    Thread Starter prodromoi

    (@prodromoi)

    The page.php file currently contains the following code:

    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div class="text">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    			<div class="post">
    				<h1 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    				Posted by <?php the_author(); ?> on
    				<?php the_time('F j, Y'); ?>
    				<?php the_content('Read the rest of this entry &raquo;'); ?>
    				<div class="postinfo">
    					<div class="alignleft">Posted under <?php the_category(', '); ?></div>
    					<div class="alignright"><a href="<?php the_permalink(); ?>#comments">Comments (<?php comments_number('0','1','%'); ?>)</a></div>
    				</div>
    			</div>
    			<div class="postline"></div>
    
    		<?php endwhile; endif; ?>
    
    </div>
    
    <?php get_footer(); ?>

    But unfortunately I’m not nearly familiar enough with PHP programming to work out what I need to add to it, or where…

    If you could help a dumb-ass like me to sort that out, it’d be appreciated…!

    I presume it’s the page.php file that needs this section of code added?

    Right. If you want to get rid of the whole box saying Posted under and Comments (…) just remove the four lines starting with the div that’s got its class set to postinfo.

    If you’d like to allow comments on pages though you may still want to show the number of comments in that box. In that case just remove the line saying <div class="alignleft">Posted under [...].

    Thread Starter prodromoi

    (@prodromoi)

    I went for the second option since I wanted to retain the facility for comments, and it’s worked just fine – thanks very much indeed.

    I’d been scratching my head trying to work out how to include an IF condition regarding the is_single tag because I thought that removing this “Posted under…” section would have removed all occurrences, including blog posts (which I wanted to retain).

    It does seem a shame that pages can’t be assigned categories though. Is this an omission inherent in this particular theme, or across WordPress in general?

    would have removed all occurrences, including blog posts

    Just notice that there’re different template files for posts and pages, i.e. single.php and page.php respectively. This way you don’t have to worry that changes done to your page.php will change the appearance of your posts in any way because this template will just be used on pages.

    Is this an omission inherent in this particular theme, or across WordPress in general?

    That doesn’t depend on the theme you’re using, it’s just not there in WordPress in general. You can read more about that here, in particular “Pages cannot be associated with Categories and cannot be assigned Tags. The organizational structure for Pages comes only from their hierarchical interrelationships, and not from Tags or Categories.“.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How do I assign categories to pages I’ve added?’ is closed to new replies.