Link pages to custom post types - wordpress

I have a WooCommerce site which has a custom post type named 'products'.
Each product is associated with 1 or more technologies which I have detailed in a set of pages. There are 8 pages in all, one for each technology. The pages are accessible in a "Technologies" menu on the site.
I want to be able to link products and technologies so that I may call up the linked pages on product pages. I will have a technologies section where I will list the technologies, the key image and excerpt. The thing is, every product uses different technologies.
What I have imaged as a solution is a way to link the pages to the product much like I would link categories. Then on the product page, I can get the attached pages to that product.

From what I understand from your question, the answer is available at the Wordpress codex. If this is not the case, you probably have to formulate your question better.
From that page from the codex, you can pick up a line as simple as this one:
<?php wp_list_pages('post_type=yourcustomtype&title_li='); ?>

I've found a very useful plugin called "Advanced Custom Fields"(http://www.advancedcustomfields.com/) which allows this. With this plugin, you can create Relations between a post and other posts/pages.
Then in you post, you can call up the related post objects and pull all the information you like from them.

Related

Multiple Part Wordpress Post

I want to create a blog with stories. Where each story may have multiple chapters. I want to publish chapter wise. Is there any plugin to handle this in WordPress?
You could use core functionalities like categories or even tags as the root of your stories and publish each chapter as new post in this category or with the assigned tag.
Then you could display your stories on an archive page with a custom loop, depending on how/what you want to display (eg. title, content, excerpt...).
You can do this with the Custom Post Type. Here is the plugin you may use.
https://wordpress.org/plugins/custom-post-type-ui/
You can set your Stories as Custom post type and Chapter as a Custom taxonomy. You can also call them on any page, sort them as your chapter vise, you can also show limited chapters stories, etc. with the WP_Query.
https://developer.wordpress.org/reference/classes/wp_query/

WordPress Custom Post Logic

I'm a newbie here, but I've been trying to understand and research this for the past couple of days to no avail.
I created a custom post type (video) with a taxonomy associated with it (industries). The taxonomy "industries" has multiple categories (I'm not sure if in this case they are called terms rather than categories; correct me if I'm wrong!) such as IT, Construction, etc. For arguments sake, let's say under the category IT there is a single post named Web Developer.
First question: With the logic above, how would I manage to reach the single post (web developer) with the URL: .../video/IT/web developer?
Second question: If on the video page I would like to display all posts in all categories, what template page should I create? Is it archive-video.php? The same question goes for the category (IT in this case): Which template page should I create in order to display all posts under a specific category?
I'll answer your second question first:
Yes, the template you should use for displaying all the custom post types would be the CPT archive, so archive-video.php sounds right.
For the categories (the exact way to say it would be "taxonomy terms" indeed), you would use taxonomy-{taxonomy}.php or even taxonomy-{taxonomy}-{term}.php if you need to get more specific.
About your first question, there is currently no core functionality to use custom taxonomies in your permalinks, but this might help you.

Wordpress: Using Custom Post Type for image list of Product

I have a Wordpress-blog with gift ideas where I write text based articles. I recently discovered Custom Post types which I believe is the solution to an feature I want to create.
What I want:
Be able to tag each custom post using the normal "Categories" and "Tags".
Create a 3x3 matrix with product images (custom posts) to be shown on top of each Category-view or Tag-view (followed by the typical article list in the category or tag).
Example:
Lets say I have a category "Gifts for mom" and tags "Pink", "Cheap"
In the category "Gifts for mom" I have 10 text articles (normal posts) discussing the difficulties of buying gifts for your mom
I create nine custom posts, each is a specific gift (e.g. A pink hairbrush). I want to place them in the Category "Gifts for mom" and tag them with "Pink".
When I view myrandomgiftblogname.com/category/gifts-for-mom I want to be able to get a view:
Gifts for mom
Product Product Product
Product Product Product
Product Product Product
Articles:
- This awesome article
- That awesome article
- Etc
I assume this is possible but don't really know where to begin. Could you point me in the right direction? Which Plugins do I need? Do I need to do any programming myself (or just plugin configuration)? Is this even possible?
The description is a bit broad, hence a bit broad answer.
Two things are needed:
1) A plugin to create the Custom Post Type.
It is considered best practice to let CPT's in Plugin territory. So you can swap designs and preserve your CPT functionality. In reality, you are asking for future problems letting this be handled by the theme.
Create your own plugin, which would contain a register_post_type and any extra configs.
Use an existent plugin, like Custom Content Type Manager.
Its Custom Fields features are quite handy as well.
Allows users to create custom content types (also known as post types) and standardized custom fields for each, including dropdowns, checkboxes, and images.
2) Learn how to use and customize WordPress Templates
http://codex.wordpress.org/Templates
Templates are the files which control how your WordPress site will be displayed on the Web. These files draw information from your WordPress MySQL database and generate the HTML code which is sent to the web browser. Through its powerful Theme system, WordPress allows you to define as few or as many Templates as you like all under one Theme. Each of these Template files can be configured for use under specific situations.
You can try the following:
Add a new Page for each category with the exact same name as the category.
In the Images menu attach to each of those pages the images you want.
In your script query for a page with a name identical to the current category, and pull all of its attachments

Wordpress - Best way to differentiate between Blog Posts and News Posts

I am implementing a clients website in wordpress that has both news and blog posts. The homepage is satic page but the nav bar has the links to two different types of posts - NEWS AND BLOGS. Though both are exactly same however they are to be made accessible entirely separate from each other through the navigation bar.
Now I would like to know what is the best possible way to differentiate between the two in the admin panel:
I mean i can create custom post types for either one or for both the types or on the other hand create no custom post type but just a taxonomy to divide the two into different parts as news posts and blog posts. Also I think I can use the custom field option to differentiate between the two...
Kindly keep in mind that the news and blog posts will be made by the client himself...
Going with this train of thought
Kindly keep in mind that the news and blog posts will be made by the client himself
I think that the best option would be to create a custom post type for "news" and leave the standard blog posts unchanged.
As you can see in the official documentation. Once you create a custom post type, a new top-level option will be created in the admin panel.
Which would allow for the following use scenarios:
Posts > Add New
Posts > All Posts
News > Add New
News > All News
Keeping the taxonomies out of this is also a good idea. Because that would allow you to keep them meaningful and share them among different post types.
e.g: clicking on "open source" category would show a list of "posts" and "news" related to that particular topic.
This yoast article covers a few more advanced scenarios and how to manage them.
Using custom-fields would probably confuse the end user. Especially because there will be times where they forget to add the field altogether, and wonder why the post is not showing on the page at all.
hope this helps
J

Creating relationships between posts in WordPress

Is there a way to create an exlicit relationship between two posts in WordPress regarless of what categories those posts might be in?
The idea is that within the post template it would be obtain and list the related posts for the current post.
I'm guessing you could achieve this using tags to group posts together, but that seems to be a hi-jacking of the tag system for a purpose for which is wasn't designed.
Any ideas?
Would adding post IDs as meta data help? I had written a quick hack to display the Digg box for posts that were submitted to Digg. I was manually adding a digg_url meta field with the Digg URL. Perhaps you could add multiple related__post fields and add some code to iterate through all and render post links? Are you looking for a more automated solution?
Maybe I didn't catch the point, but Categories are not just there for that purpose?
I may have miss understood the question. But tags, archives and categories are there to "connect" posts, on the basis of that common connection.
Other than that, I can only see ...
Manually linking posts from with the text of a blog post or
Using plugins. Two I user are similar posts (http://rmarsh.com/plugins/similar-posts/) and SEO Smart Links (http://www.prelovac.com/vladimir/wordpress-plugins/seo-smart-links)
Similar posts if highly configurable and allows the blog to automatically suggest "related posts" and SEO Smart Links, links (in post) words or phrases to related posts.
All the best
stephen

Resources