Wordpress custom sub template, Template within template - php

I have a custom post type defined in Wordpress. Please look at the following image(not my work just used for reference):
For each of the posts within the custom post type I would like to define 3 sub templates that can be chosen from within the WP admin:- Content left, Content centre, Content right. When they are rendered out within the loop (not single page) the output would be similar to the above image.
Can this be done in Wordpress? If it can please can you help point me in the right direction?
Many thanks in advance.

You can use custom fields to give the three parts content. Custom fields can only handle plain text so you can also use Advanced Custom Fields to add a ritch .

Related

Page break not working for WordPress custom post types

I want to break single WordPress post into multiple pages and i know that i can simply achieve this using wp_link_pages function but unfortunately it's not working for my custom post types. For custom post types it's generating the links but when i click on the link nothing happen.
I have tried to find out the issue but did not got any clue. Is i have to do anything extra for my custom post types to use wp_link_pages function?
You can use the following single code in the position you'd like your content
split.ensure that you are writing the code in the "Text" display editor
rather than the default "Visual display editor(note the two tabs displayed towards the top right in the editor)
<!--nextpage-->
top right of your post or page editing screen)".

Wordpress - using advanced custom field plugin for a template file

I'm using ACF for a Wordpress site for the first time. I have a template file that I use across a number of pages - topimage-agency.php - and I need to make a paragraph within it dynamic.
I've created the custom field using wysiwyg editor and selected the main Agency Page -
Obviously I haven't set the template up with its own page so I've had to select one. The code is dynamic on the agency page and all works fine however it doesn't show/work any differently on any of the other pages. Is there a way I can make elements of a template dynamic using ACF or any other way?
You need to select Page Template instead of page. Then You Select Page Template name instead of page name(AGENCY).
If you do like this, your custom field will appear all the pages where you specify that template.
Hope this helps to you!!!

Wordpress changable text in custom html

I have a custom page (page-news.php) and I styled it. Now I need to change some texts, and I dont want to do this in hardcoded page-news.php but I want to be able to change that in Wordpress, without go to code. Did you have maybe some ideas how to do this?
Here is visualization of how I think it should work (the only thing I can change would be white custom-text with section-1,section-2 and section-3) and I will be do this in wp-admin > pages >news:
Any ideas? I will be grateful for answer
Use ACF plugin. After installation, you can create custom fields and define their types. In your case, you should create 3 editor field or textarea and attach them to you page. When you visit wp-admin>pages>news you'll see these fields. Use get_field($fieldSlug) in your page template to show the values.

To create custom the wordpress template with both the static and dynamic mixed

I am trying to customize the wordpress template.
In that template the content will be both static and dynamic.
Images, color and button will be static.
All other content will be dynamic.
What I am trying to do is that if i change button name or color in that template it should affect is all place in the sites.
I know about the the_content() I don't know whether split will work.
But is their any to do this process in the form of template.
For Example see the image here
Please need help.
Thank you in advance.
for having dynamic content on your website you can use custom fields..
you can either use the Wordpress built in custom fields or a very good plugin Advanced custom fields (ACF) ..
explanation can be lengthy but you can refer to below documentation and actually it is very simple..
https://codex.wordpress.org/Custom_Fields ( For WP built in Custom fields)
https://wordpress.org/plugins/advanced-custom-fields/ ( for ACF plugin )
Hope this helps
Take care and happy coding
If you just want your first title dynamic, then you can fetch data title from your page like with
the_title();
And all your remaining data will be static in this way you can get your layout easily ... as far as your button pop up message concerned, you can use jQuery to achieve that and can show any of your message. Hope that solves your issue

Wordpress Display Content in Sidebar on Specific Post/Pages

I am not sure exactly what I am looking for in the api so I'm going to ask here. On a post/page, I want the ability to have a piece of text display on the sidebar ONLY that content. The content to be display is to be set as an attribute or something similar in the edit area of that post only.
Is there a way of doing this and where do I look in the api?
Using a text widget as already mentioned, you can use the Widget Logic plugin and use an if statement to display that widget only on the post you want.
http://wordpress.org/extend/plugins/widget-logic/
If you are looking for logic to do this here it is:
In your post you have access to custom variable so create one which you will then access in sidebar and if that is true then a widget can be shown else it does not need to be.
You need to access this custom variable outside post loop which you can use by using global variables and assign its value to that.
In your widget you need to look at globalvariables and check the value of above and then do your if else logic to show or hide parts of content in sidebar.
A good starting point for this can be this tutorial which does show twitter or facebook posts based on custom variable on post.
You can use this plugin and either select pages, post-types or even a comma separated list of post ids http://wordpress.org/plugins/display-widgets/

Categories