Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I couldn't find an answer relating to this, maybe I just didn't come across it yet.

So the setup of the site I am working on at the moment:

The Front Page is not set, is default. I can't change this because of the way the template functions, it would be too much work for me to change it.

The site already has categories setup, but none are called 'Blog'. The client wants there now to be a 'Blog' category which see can assign posts to as her personal 'Blog' - away from the rest of the site's categories. The thing is she also wants to have a number of other categories' posts show up when navigating to that '/blog/ URL.

How would I go about doing this?

  1. Would I duplicate the existing 'archive.php' file and make modifications, and somehow point the /blog/ URL to it?
  2. Do I have to modify the 'archive.php' file to pick up the URL and modify the query?
  3. Create a filter/action for his purpose.

The page would display like any other archive, as in posts are listed in date order back.

Note: I can't move the existing categories, they must stay where they are.

I'm wondering by doing this at all will it have repercussions i.e. will it cause other issues?

Thanks for your time, much appreciated.

share|improve this question
    
I would, strongly advise against using 'blog', it is a reserved keyword, you could encounter all manner of unanticipated bugs and unexpected issues –  Tom J Nowell Feb 5 '13 at 11:27
    
I didn't think of this, but how do you explain people using '/blog' in most sites out there? Only for that I wouldn't of though of this. –  Anthony Feb 5 '13 at 13:34
    
because it's a special case, added internally by WordPress to prevent clashes with sites in a multisite using subdirectories –  Tom J Nowell Feb 5 '13 at 14:25
add comment

2 Answers 2

up vote 0 down vote accepted

In my opinion you should create a new page-child.php and new categories just for that. And assign that page to the blog posts and the new GrupOf categories in use.

Not sure if there is any better solution at least this one will not compromise the rest of the site.

But wait a bit more for some replies maybe someone has a clear / different opinion.

Good luck!

share|improve this answer
    
Yeah, I'll see what others have to say. I want to minimize the amount of work I need to do. Basically these 'combined' categories would need to reflect the working and layout of the 'archive.php' exactly. This is why I was wondering if it was possible to use that file or an action/filter to modify the query on the fly based on the URL. –  Anthony Feb 5 '13 at 13:36
    
seems the best will be a copy of your archive.php "archive-bolg.php" and do a new query loop for all blog categories... –  jose pacheco Feb 5 '13 at 18:07
    
I completely forgot about that. I was over thinking it all along. Thanks. –  Anthony Feb 5 '13 at 22:13
1  
I actually end up using "pre_get_posts". Though at first I couldn't figure out why I wasn't able to add multiple categories i.e. using set('cat','id1 id2 id3') etc.. It turned out that because 'categoryname' is already on the query set it ignores the 'cat' element. The solution was to clear 'categoryname' and then set 'cat'. –  Anthony Feb 6 '13 at 15:18
add comment

In your permalinks, specify a custom permalink structure, and prefix it with /blog

e.g.

/blog/%year%/%monthnum%/%postname%/

There are also the category and tag base prefixes on the same settings page.

share|improve this answer
    
Thanks for the answer but this is a completely different fix than what is intended. I can't change permalinks because the site is already full of content and because of SEO purposes. –  Anthony Feb 5 '13 at 15:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.