Right now one this certain ACF is only displayed on the user end of the relevant page where generated ACF editor appears.
What I want to do is make a 'global' ACF, featured in certain php include that will appear on most of the pages in my template.
How do I achieve this?
The only way I can achieve this effect is disregard my include, recode each page where I want that global ACF to appear, and then make sure ACF editor appears on each page in wp-admin, which isn't very graceful.
Thanks in advance.
I also had the same issue too. If you still need a solution (or for those who still need an answer) ACF have released a premium add-on called "Options" ACF Options.
This will allow global use of custom fields. Check out the video tutorial on the page to customize the sidemenu for grouped global content.
<?php the_field('field_name', 'option'); ?> will call the content of that particular field.
I hope this helps.
Related
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.
I use Elementor page builder on my WordPress site. There is a problem with it - by default it doesn't allow editing WooCoomerce Shop/Products pages. The solution they say is to add to page templates code. I, being a beginner with no idea of coding, cannot figure out which file to add this code to and where in that file. I have been researching and trying to fix this myself for two weeks now, in vain. Please help me achieve this.
Here's what Elementor say: "Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page."
Go to Elementor setting and then check products in post types
Go to Products, click Edit on the product you want to edit, input something (ie. a full stop-sign '.') in the WP Editor, click Update. (See attached screenshot.)
Screenshot
There seems to be a misconception that Elementor can be used to "edit" any content.
For Elementor to work on a "Page" i.e. the post type that uses either the page.php or any theme declared page templates it requires the_content(); function to present in the code.
Issue #1: WooCommerce uses the woocommerce_content(); function to return the content of the shop.
Issue #2: The Shop output does not use the "Page" or Custom Page template - the output is equivalent to the index.php or home.php, neither of which are editable via Elementor.
Unless you are willing to write a pretty sophisticated function to collect all those elements' data and filter them into the_content(); function, there is currently no way of editing such content directly.
I know it's not the solution you are looking for but that is the current state of affairs. Having said that, some of us are working on all sorts of solutions and maybe, just maybe - we'll come up with a way to have this option available soon ;)
For shop page you should go to Elementor setting and then check products in post types.
Because shop page products are not the content but posts it's the solution.
So inlcude products in post types and edit with elmentor, if for some reason you can't see 'edit with elementor' under shop page, then just open shop page and add
/?elementor and it would enable elementor
NO need to add this code in any page follow these instruction.
You just need to clear cache and cookies your browser, Some time website take previous data to show the web page and give this error.
or
if you open your website private mode then login and go to the page by Elementor you will never face this problem.
I'm going to excuse myself for not adding any code to this question, but there is no need for that because my whole code works fine. My problem is explained next.
I've made a template called template-listing-products.php for displaying posts from a custom post type called products, which is being used by a page in my WordPress website. In that page I have slideshow where I load images into it using ACF(Advanced Custom Fields) and list all the custom post type taxonomies names with links.
When I click a custom post type taxonomy from that page it redirects me to the template called taxonomy-products.php where I have the posts from that taxonomy. My problem is how to use ACF to add dynamic content to those pages? Like the slideshow where I have a page.
UPDATE: Problem solved.
I already had a repeater to add images for the slideshow on every taxonomy and I didn't understood why it's not appearing on every category/subcategory in admin. I updated ACF and now works. Maybe this will help someone else.
Ok. So I will answer my own question.
Problem solved.
I already had a repeater to add images for the slideshow on every taxonomy and I didn't understood why it's not appearing on every category/subcategory in admin. I updated ACF and now works. Maybe this will help someone else.
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
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/