WordPress: Inner-Page Linking, Pages based on Categories - php

I'm trying to decide which method would be best for an internal linking structure that utilizes 4 main categories, and then pages within those categories using WordPress.
At first I thought I could just use Posts as a method of determining whether or not content belonged within that category... but now I'm second guessing myself. The site structure is like this:
High-level nab:
Category 1
Page 1
Page 2
Page 3
Page 4
Category 2
Page 1
Page 2
Page 3
Page 4
Category 3
etc
Category 4
etc
Obviously, this is a custom theme. But before I start coding, I want to make sure that I'm storing, pulling and organizing the data properly.
What are you thoughts? Greatly appreciated!

Wordpress is actually designed to be a blog, not a pure CMS. If you do not use the blog function, I suggest trying another 'real' CMS (Joomla, Drupal, TYPO3, many many others).
But to answer your question, why did you reconsider ? It would make it easier to know why your are second guessing...
If you want to accomplish this with the given categories from wordpress, you can use a category to page plugin like this one here. But there are also some CMS plugins for WP that make wordpress to a proper cms and can help you grouping pages - see the plugin resource.

Related

Angular 6 single page template, but with different routes

I am currently on a project which develops Wordpress - Like website using Angular 6 front-end and PHP 7 and MySQL back-end. All we need to do is, we have different posts on different categories and show them in the website urls like these.
www.sample.com/news/news-1
www.sample.com/category1/post1
www.sample.com/category2/post2
But our post pages must be identical besides of any of articles or category types and, for that reason, we created a mother component called template-component. But the place we got stuck is when routing. All we need to achieve is to make different routes to our pages like upper urls, but keeping our template. Your help or advice are much valuable. (All categories are dynamically generated and can be create/delete or upgrade anytime)

Wordpress one pager: how to structure / posts or pages?

Heyho,
I'm new to wordpress and currently building a website for a client. It's a one-pager and I'm wondering how to build the backend.
Let's say it's a cat-business. And the structure is as following:
Haircutting
Baby Cat Haircutting
Long Hair Haircutting
Special Hair Cutting
Photoshooting
Single Studio Photos
Group Studio Photos
Owner + Cat Studio Photos
Outside Photos
Training
Faster Running
Higher Jumping
Better Mouse-Hunting
News
Contact
The categories 1—5 should form the Menu.
Every entry is (until now) a post and has several custom fields (e.g. Price, Duration, Location…) and that works fine. The Client needs to be able to edit / add / remove the single entries (e.g. "Special Hair Cutting").
How should I build it know?
First Idea
Making Pages for each category, showing the single posts assigned to the
"wordpress category"
Make the Home-Page show all the pages
Second Idea
Building everything in Posts
Building also the categories 1—5 in Posts and figure out how to apply
special CSS (workaround with Custom Fields?)
What is the smarter way to go?
Anyways I'd need further help afterwards, linking the best tutorials, as hours and hours of searching didn't help me any further.
Thanks.
Appologies for my bad English
You can build a simple one-pager by looping through the pages with depth 1 and then through each of their subpages. You can use the get_pages function for this.
Make sure to redirect the individual pages to an anchor on your one-pager/home (with a redirect plugin). This will prevent people from finding your individual pages through the search engine.
How get_pages works: http://codex.wordpress.org/Function_Reference/get_pages
How to loop through your (sub)pages: http://wordpress.stackexchange.com/questions/93844/child-pages-loop‌​

Multiple Blog Layouts in Wordpress

I want to create a wordpress blog template. Like other themes have I don't just want one layout for my blog index page (home.php). I want to have the option that the user can select between 2 columns, 3 columns, some custom layout etc.
I know I could achieve this with static pages. But for the blog index there should not be static pages. So can anyone tell me how to achieve this?
I am not exactly sure what you are asking.
Do you want your users to be able to pick from different layouts? In that case, write the layouts in HTML(you can use a frontend framework like Bootstrap to help you), use PHP to detect the user's choice(storing it in a cookie, for instance, and setting the value of the cookie with a simple form and post), and echo only the layout you'd like.
If that's not what you're asking, please update your question with some examples.

Wordpress - Make category.php list posts from subcategories as well

I'm building a blog where three people will be writing, but they will have a separate section on the site. The structure is built upon categories and looks like this:
User one
Clothes
Fashion
Life
User two
Family
Life
User three
Family
Friends
Life
I've set all three users as writers and used the plugin Restrict Categories in order to lock their categories to the sub-categories the matching each top level category.
Now here comes the question, if I visit http://site.example/category/user-one/ I want to have a listing of all the posts, including the sub-categories since there will be no actual content in the top level category that you are browsing.
I've tried making this using filters bound to pre_get_posts but I still can't get it to work. Does anyone else here have any ideas?
I've also given some though into actually creating a multisite network for the purpose, but I then realized it will be hard to fetch posts from all the networks at once.
Thanks in advance, Jonathan
#Jonathan: Not sure if I am misinterpreting what you are hoping to achieve, but given that each author will already have their own 'author' page which lists all their posts (if your theme includes this or something you could create or customise), there may not really be a need for Users 1-3 to be their own category?
Going back to your question, for listing subcategories, perhaps https://wordpress.stackexchange.com/questions/13485/list-all-subcategories-from-category might be of some help.
As for listing posts, to keep things simple, I reckon you might be able to use e.g. get_posts (http://codex.wordpress.org/Template_Tags/get_posts) and build custom arguments, perhaps in a loop if you prefer to use one instead of slug/id specific category templates.
http://codex.wordpress.org/Category_Templates
If it's any help, Bainternet actually created a plugin that makes life a little easier to define category templates: http://wordpress.org/plugins/custom-category-template/

How to handle the subpage concept under Yii?

This is a very newbie question so bear with me. I'm starting to use Yii as my first PHP framework and so far so good, the project on wich I'm learning is a simple informative webpage, but how am I supposed to handle the subpage concept under Yii? This is what I'm trying to achieve:
Home
Products
Product 1
Product 2
Contact
I have a controller for Home, Products and Contact, now I know that Yii doesn't work with subcontrollers, then how do I create a Product 1 and 2 subpages? Just a different view for each one? Through Gii? Many thanks.
You could do one of two things
You could have a generic product page that accepts a parameter to distinguish between different products (common approach). For example,
www.mysite.com/products?id=1 would show Product1's page whereas www.mysite.com/products?id=2 would show Product2's page (and if there is no id parameter in the query string, then you could just show your Product page)
And you could also have separate methods for each page. So you would have
actionProduct
actionProduct1
actionProduct2
methods in your Product controller and then you could reach your pages as
www.mysite.com/product
www.mysite.com/product1
www.mysite.com/product2

Categories