Custom Page Post Query Template - php

Goal: Create Wordpress page template so that my custom page post (blog) looks like my news posts.
At the moment it looks like this: http://freelifecc.com/blog/.
Has no real formatting or blog structure post to post. I would like it to look similar to this: http://freelifecc.com/blog-posts/the-best-defense-money-cant-buy/ except it display multiple posts.
Note: News is used in the template I'm using as the default blog posts. It's woven into the entire wordpress template so I'd rather not change that.
At the moment I'm using Custom Post Type UI to create a new post type (blog) and linking it on a page using plugin: Query Wrangler and plugin: Widgets on Page.
What do I need to do and how can I accomplish it?

Related

automatically duplicate wordpress post with different title and same content

I have a WordPress website where I post blog for different cities and the content of all post are same
so, is there any way I can create multiple posts for multiple cities? i just have to change the title and rest everything is the same
You can use any plugin for post/page duplicator, after duplicate post/page you just need to change the title and slug.
You can use this plugin: https://wordpress.org/plugins/duplicate-page/
Or you can use which you like most.

How to render a Wordpress blog list to display below WP Bakery content

I am using the WP Bakery Page Builder plugin. On one of my pages, I am using this plugin to create a title along with some text. I then changed the template to a Blog template, when previewing my changes I can see my posts displaying correctly however the title and paragraph built with the page builder is showing underneath the blog posts.
How can I change this, as I am unable to see the code for where the blog posts pull in within WP Admin.
Created a copy of the grid.php file and moved the code that creates a loop to change where the code is being rendered.

How to manage category name before blog post slug title in PHP?

I have seen many blogs and tried but I want something another.
The blog post URL I've tried -
localhost/post/how-to-include-category-title-in-blog
same for
localhost/post/how-to-create-php-script
There is the common thing is post page -----
I need that -
Suppose that I have three categories in my blog - PHP, HTML, CSS
I create posts in every category -
So the URL should be -
localhost/php/what-is-php
for CSS posts -
localhost/css/what-is-css
for HTML posts
localhost/html/what-is-html
Syntax like -
localhost/category_name/post_title
The category should be related to the post.
I need to remove the post and want it dynamic.
localhost/post/how-to-create-php-script
the post is a page in the blog. I want it to remove and manage according to these URL -
localhost/php/what-is-php
localhost/css/what-is-css
localhost/html/what-is-html
I am working on PHP core.
You want to get familiar with the Parmalinks page in WP admin. Here is the documentation from WP: https://wordpress.org/support/article/settings-permalinks-screen/
For your need you probably want to try a custom permalink config like:
/%category%/%postname%/

Applying a template to a Custom Post Type Wordpress

I am trying to apply a template to a Custom Post Type in Wordpress. Currently I am displaying a list of Custom Post Types on a seperate page and I'm using the permalink for each post as the URL to go to when a link is clicked.
Code to generate the links:
<h2><?php the_title(); ?></h2>
This redirects me to a page with a URL like this:
http://xxx.xxx/?pa_supplier=xyz-packaging-ltd
I am wondering how I could customize how this page might look.
I know for pages you can create a php file called page-id.php and subsitute the page id in and that will allow for customization, can something similar be done to Custom Post Types?
Simply create a new template file in the theme folder and name it with following syntax: single-[post-type_slug].php, for example. If we have a post-type named "projects", the file for displaying a single projects post would be "single-projects.php".
Check the following link for more information:
http://codex.wordpress.org/Template_Hierarchy

Custom URL rewrite in wordpress

I am trying to achieve a custom URL structure with Wordpress. Basically, my site functions as my blog and my portfolio. I want to have an "Articles" section and a "Portfolio" section. I want the articles to display on the Articles page, and the portfolio on the Portfolio page. Should be easy, except on top of that I want custom URLs...
I want the URLs setup like this:
Articles page:
http://mydomain.com/discusses
Specific article:
http://mydomain.com/discussed/%postname%
Portfolio page:
http://mydomain.com/does
Specific design:
http://mydomain.com/designed/%postname%
I can figure out how to do only one rewrite of this type, but WP doesn't have built in functionality to do both. I'm just wondering where I should start or what I should do...
The problem also becomes, I want to retain category functionality in both areas, so maybe it needs to be achieved with Custom Fields? and add a new rewrite rule based on the custom field of a post? I have idea where to start...
Thanks for any help you can give.
This actually isn't that hard to do. I'll go down, page by page, what you would need to do to achieve this.
Articles Page
Create a new template in your theme folder (/wp-content/themes/your-theme/) called discusses.php and just add the following content:
<?php
/*
Template Name: Discusses Template
*/
?>
You don't need any more content. Go into the Pages section of WordPress Admin and create a new page called Articles page and set the URL to be /discusses/. Set the template of this page to be Discusses Template. Now, go into the Settings → Reading section in Admin and set the Posts page to Articles page. Now all your blog posts will appear under the URL /discusses/
Specific Article
The easiest way to have all your articles appearing as /discussed/title is to rename the default category (in Posts → Categories) to discussed. Then set your permalinks to be:
/%category%/%postname%/
This will render the links you need for each post.
Portfolio Page & Specific Design Page
Assuming this will be some kind of custom design, the easiest thing to do would be to create a custom template and Page in the pages section, as you did for the articles page, and throw your custom HTML and CSS into that. I would then set each specific design page to be a child page of that in the pages section. You can use the WPdb classs to make custom queries to populate the Portfolio page.

Categories