Multiple Blog Layouts in Wordpress - php

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.

Related

What is the best way to create page in Drupal 8 so that I can then add these posts with images?

I have a Home page on the Drupal website (such as is created after installation), but I still need to create this page:
What is the best way to create a page so that I can then add these posts with images?
I am just starting to learn Drupal and have heard so far about such ways of creating pages:
1) in admin toolbar: Content / Add Content / Article
2) in admin toolbar: Content / Add Content / Basic page
3) in admin toolbar: Structure / Views / Add Views
Which one should I use? Or maybe there is some other option that I don’t know about?
P.S. At the moment I am more interested how to create empty page on which I can then add posts later, and adding posts it is another question.
Welcome to Drupal.
Drupal ships with the default theme which won't look nice but it does its job in the right way. Now if you want to create a better UI/UX obviously you should create a new theme. But before that make sure to read and understand the concepts behind Drupal. Drupal docs are your first friend.
Drupal Documentation
Drupal considers everything as nodes and that's how Drupal got its power. As you mentioned, Articles, Basic Page etc are called content types and they can be used to create a particular type of content.
Now for your purpose create a new content type and add the fields you need. From the image above I can say your content type needs Title, Image, Category and Date. After creating content type you can create as many contents as you want under the content type you just created. Consider each card in your image as content.
Now you can use a Drupal Core Module Views, to perform DataBase Operations without writing single code. Yes, you can select fields, sort, order etc with Views UI and display it in a page or a part of a page (Block).
I would say just try this out in the default Drupal theme and when you understand how this works, you can start creating your own theme for your project.
Theming Drupal
There is a lot of resources available. But you have to make sure what you are asking is whether you actually need. It will take some time, but it worth.
To build layouts for homepages on Drupal 8 you best friend is https://www.drupal.org/docs/8/core/modules/layout-builder
To build the content blocks inside your home page, you should start creating nodes on a node content type to hold your information. For instance: news content type, with a title, a body, a date, and an image.
For every node type, ex. news, work on the preview display, full display, and any other display which makes sense. These displays can be used later in the Layout Builder directly or in Views, referenced below.
If you wish your list to be dynamic, such as the last 10 entries are shown first, then use a view to hold the content sorted and filtered as you need.
In a nutshell.
Create a content type for your article/news.
Modify the displays of the content types to have at least a summary and full view.
Create the content itself to have something to see.
Create the view (block) to filter and sort your content.
Create a page layout (this makes sense for landing pages) which places your new view and any other content you need in any disposition.
This is roughly what I would do. The steps described above contain many intermediate steps. If in doubt, check the docs.
I hope that helps!
First, decide what will you display on that page. Is it content in some existing content type (article maybe) or you want to crate new one for this purpose.
If you need new one then create it (Structure -> Content types -> Add content type).
Then check what fields will you need. I.e. image, some description text. Add missing ones.
Create few nodes (pages) in that type so you could work with them.
Then for displaying you should crate a view (Structure -> Views -> Add view). It can be a page view (you are displaying only that content on page) or block view (this is just a block among some others). If you create a page you could visit it and if you create a block you have to add it to some region to appear on page (Structure -> Block Layout).
Inside your theme you should create templates for this page/block. Turn on twig debug mode so it will show you hints - what templates are used and how can you name yours to override default ones.
Adjust CSS to make it look like you want it to look.
Find some tutorial(s) for the details
Previous answers have given the flow of the work you should go through, I would like to add some resource that might help you achieve this.
Creating content type and fields: https://www.drupal.org/docs/administering-a-drupal-site/managing-content-0/working-with-content-types-and-fields
https://www.drupal.org/docs/user_guide/en/structure-content-type.html
View and View modes: https://www.drupal.org/docs/user_guide/en/views-concept.html
https://www.drupal.org/docs/8/api/entity-api/display-modes-view-modes-and-form-modes
Handling block of the view: https://www.drupal.org/docs/8/core/modules/block/overview
Feel free to ask if any further explanation is needed.
Thank you

How does WordPress Dynamically Generate Pages?

I'm new to web building and programming and what not, but I'm trying to create a website with a lot of pages. Note that this is pages not posts. The pages will use the same layout, but the content will be different. It's very inefficient to create the pages in Wordpress. I was wondering where does Wordpress store the database that is used to generate the pages. I figured I'll just add information to the data base - which would be much for efficient.
Any ideas on how to do this? Or other ways to create many pages efficiently. I would love to be able to work with Excel or some other text software, rather than the slow Wordpress platform.
Thanks!
All content are saved to the wp_posts table in your WordPress database. whether its for pages or as posts. Databases are provided by your webhost. Edit: Excel is not a web authoring program, nor should it be used as one.
You should put your header in header.php and footer in footer.php, and main content if it's not post type in page.php or you can make you custom page template, also if you are use page and not post, don't forget change it from settings
You can't use Excel for your data. You can only use the Wordpress Database or external files.
As stated above, pages are stored in the posts table.
Since your data isn't actually dynamic, you should probably go ahead and create individual pages and create a template to display the pages the way that you want them to look.
https://developer.wordpress.org/themes/template-files-section/page-template-files/
For the record, you can use a single page to output different content. Most shopping carts, for example, are displayed using a page called 'Cart' (or something similar), but the output is different. The Events Manager plugin outputs events to a page called 'Events'. This, however, is for truly dynamic data and not what you are looking for.

WordPress: Inner-Page Linking, Pages based on Categories

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.

Simple PHP CMS with internationalization, static website, and blog capabilities?

I would like to know if there's a PHP CMS which makes things like editing a block of text easy.
It also should let the user separtare content in columns.
I'm using Wordpress right now, but it seems like the only way of letting the user add content is in form of posts.
Any suggestions?
Take a look at MojoMotor it's different from the standard CMS packages and is based off CodeIgniter.
Joomla is the Answer. It has all the properties you mentioned
Wordpress allows adding pages too. These live outside the blog and are not automatically shown in the blog index.
If you decide to drop WordPress after all, you could take a look at 9 alternatives to WordPress.

Drupal Views Automatic Filter

I was just wondering if there was a super quick way to automatically add a filtering system into Drupal views.
I.e. I just need to add in the top of my view search by name (text box) and search by category (drop down box)
Or do I just manually create this form then use the filter agruments within the edit view screen?
I found the answer.
It's part of the Views Module under filters - then you just expose them, simple...
Not sure what Daniel was on about?
I dont understand exactly you question, but have you tryed VBO?
However, when you create a view you can 'expose' the filters you use, so the user can change it in the view page.

Categories