WordPress Theme or Self Generation? That is the question. At the moment I do not have sufficient information. I have quite definite views of what I want the site to look like, and of course it has to work across all device types. I am pretty sure WordPress themes do scale nicely depending on device and orientation, and that would resolve a shortfall in my knowledge. However, I am not sure how to configure WordPress to give me the look and feel that I want, plus a part of me wants to fill in my lack of knowledge. I am also of the opinion that, before you can decide whether a third party product is up to the task, you need to know enough about the task to make a judgement.
On that basis I have decided to bite the bullet and hand-craft the site in VS2012. That will mean, at some point, working out how to integrate WordPress into a hand-crafted site, but I am sure I am not the first person to go down that route.
Actually progressed very nicely down the self generation route. I managed to get the front page and content pages responding nicely to different devices, orientations, and screen widths. However now has come the time to integrate WordPress fully into my site. (Or perhaps it is the other way round, convert my site over to WordPress structures).
Why have I decided to do this? Three reasons:
- My blogs are obviously not part of the overall site. They look and respond differently, so I definitely need to ‘Theme’ the blogs to match the rest of the site.
- WordPress does an excellent job (as you would expect) of segregating Content from Layout, and whilst the mechanisms I had put in place did provide for Layout templates it did not match the separation achieved by WordPress.
- I could have continued down the Self Generation route and, aided by the WordPress concepts, developed my own system, but then I would still have needed to integrate the WordPress blogs.
So I have decided to integrate and use WordPress to manage both blog and page content.
How to go about this? Well the step is to define precisely what I want to achieve. The second step would be to the Codex to determine how I go about it.
What exactly do I want to achieve:
- Want the Blogs presented in Quintic Style
- Want Pages available from Initial Home page
- Want the pages constructed using WordPress – ie Content from D/B, Presentation from Templates
- Want the sites initial home page as is. (Need to see how WordPress deals with differing screen sizes and orientations.)
Looking into Pages.
Pages in WordPress are retained in the same structure as Posts. indeed they appear to be almost the poorer brother of Posts. The D/B table, wp_posts, holds posts, pages, images, etc. with the post_type column indicating whether the entry relates to:
The wp_post table also includes the following columns which are of interest in knowing about the data retrieval:
- post_content – The actual content for pages and posts (Not images)
- post_title – Visible title
- post_name – as required by url request.
- post_mime_type – Used for images and other content
- guid – unclear at present, looks like a url, but also has an Id, which is post_type dependent. (That is a post might have an id of say p=1 where a page would have an id of page_id=1)
First thing is, in the development env, is create a front-page.php that matches the Quintic Front page. Front-page.php, if it exists in a theme, is the page that WordPress loads s the intro to the site. This requires that I:
- Create a Theme, which requires as a minimum:
- Create a header.php and footer.php
- Work out how to load menus
- Work out how to load images, and how to swap images based on media.
WordPress Themes are a large topic, but at least now I know more than I did about them, and how the integration with Quintic will work.
I need a theme of my own. I have decided on a name: Q5. it will be a complete theme, not a child theme. I am pinching stuff from TwentyNineteen and _s (_s is a ‘template’ theme for want of a better word that provides good hints as to what a theme should contain)
- The Quinitc Front-Page as is will become a front-page.php entry in the theme.
- The Blog posts will be displayed by single.php
- The Pages will be displayed by page.php
- I need to create a section php for sidebar, comments, etc.
I already have header and footer just about sorted, although I do need to resolve the menus on the header.
One point to note. WordPress’s ‘Loop’ , is not what I expected. I was expecting a php function, possibly called ‘loop’, which would retrieve and display what was requested. Nope, that is not it. The Loop is a piece of php code that is included in all the php pages that displays WordPress content (eg index.php, single.php, page.php, about.php…), that automatically analyses the url to decide on the content and then returns the requested content in a while loop.
<div id="primary" class="content-area"> <main id="main" class="site-main"> <?php while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content', get_post_type() ); the_post_navigation(); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; endwhile; // End of the loop. ?>
If you look at the code in say index.php from one of the WordPress themes it appears that is specific to ‘posts’, certainly my initial reaction to the ‘have_posts()’ function is that it would be post specific and that you would have different functions for other post-types. However that is not correct, the ‘have_posts()’ function, as mentioned above, analyses the url request to decide what content to retrieve and then retrieve it iteratively.
Took me a while to come to terms with the fact that WordPress returns content not Page centric or Content centric, but just whatever content can be requested and in whatever order the theme decides. And that concept is actually pretty central to the idea of Blogs, Web-Sites and WordPress. I was too focused on each Blog subject being a ‘Page’, and therefore a page was the unit of information that you wanted to retrieve from the WordPress d/b and the display. That is completely wrong. What you are retrieving is content that you alllow the user to request. That content can be on a single topic or a range of subjects, and how that content is presented is dependent on the theme. So it can be one blog per page, or it can be all blogs on a single page or – a fixed piece of technical info, followed by a blog on the subject
Integration with WordPress
Already indicated above that I need to work with Themes to get my static pages integrated into WordPress. If I am also gonig to add a BLIKI, then I also need to incorporate a Plugin. The book that I have – “Prodfessional WordPress – Design and Development” by Brad Williams is OK. I cannot recommend it, if only for the fact that is for WordPress 3.0, and it does seem to concentrate on the how, not necessarily on best practice, but it is a reasonable start. It is at least enabling me to understand much of the terminology in an around WordPress, for example:
- template tags
- the loop
- actions, filters & hooks
I am now getting somewhere with learning WordPress. I have been through the Plugin development section of Professional WordPress, and have read most of the Theme generation section as well. I have also read the theme development section on WordPress.
In order to complete my theme I need two types of static page, plus the blog pages (posts), plus the BLIKI pages. The BLIKI pages I have already determined need to be added via a Plugin. The reason for the two types of static pages are that I want a different style for the Front-Page, About Page, Contact Page and Policy Page that other static pages. Basically I want to have a Corporate Static Page style and Technical Static page style. However these differences are definitely Theme differences, there is no functional difference between the pages (Unlike BLIKI pages, which will have functional enhancements.)
I could implement the Corporate pages as a fixed set of contidional tags. That would give me what I want, but that would not be very extensible as far as a publisghing a generic theme. So instead I may well look at the Customiser UI to identify the list of ‘Corporate Pages’, but first i will see if there are any other Themes out there doing what I want.