No search results were found in Documentation!
Im trying to add a subheader in a module with Advanced custom Fields (ACF) plugin
But when adding code like this in module_10
<?php echo $this->get_comments();?>
———-> <div class=”MY CUSTOM FIELD”><?php echo $this->the_field(‘MY CUSTOM FIELD’); ?>/div>
<div class=”excerpt”><?php echo $this->get_excerpt();?></div>
I tried various ways: but keep getting:
Fatal error: Call to undefined method
Anybody?
The page count actually counts how many times the page is loaded/viewed and not tied to FB in any way. Page views are written to custom field per post (look at the extra fields in your post view). So, you can update theme without losing the post views per post.
Note that FB has been changing how they show stuff to people, so somebody liking or sharing doesn’t always translate into any specific number of views from FB — theme doesn’t control whether people CLICK THROUGH from a share on FB to your site/pages.
For advanced users, you can start using a shortcode with tracking where you use shortcode for social and then track that by number of times shortcode is clicked through. But that is likely outside the scope of what you want to do here.
Not sure any of that helps .. just food for thought.
Hello,
In order to use ACF you need to add shortcodes in the desired place in the theme files so a basic knowledge is required on how the WP template hierarchy works. you can follow their official docs to get an idea of what to do: http://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/
You will also require basic PHP knowledge to tie in the shortcode to the existing code.
You can also do a quick search through our forums to see solutions other users found:
https://forum.tagdiv.com/search/advanced+custom+fields/
I hope this helps.
Thank you!
Hi,
I’m trying to make some custom fields appear. I see other people on the forum is able to make this work.
Another contributor here adviced to add some simple html code to check that I’m adding the code in the right place. And that works but as soon as I try to add some php to get the advanced custom fields nothing appears.
I’ve tried the following code without any success:
<?php echo get_field(‘company_name’);?>
<?php the_field(‘company_name’); ?>
<?php get_field(‘company_name’); ?>
I’ve also tried “ACF export code function” but did not work either.
Here you can see an example of the code I’ve tried in loop_5: https://www.dropbox.com/s/juhws2h5cpdgcnc/acf%20code%20in%20template%20-%20printscreen.jpg?dl=0
Herre you can see the actual post: http://businesstrade.eu/2014/08/sales-agents-within-fashion-scandinavia-wanted/
Hope somebody with some experience with ACF can give me a ocuple of pointers. Thanks!!
Kind regards
Lars
Hi
Thanks for the suggestion. I’ve added it on our feature request list and we will consider it for the next theme updates. Meanwhile you can use a plugin like Advanced Custom Fields and use this method to do it: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/
Thanks!
Yes, with ACF you have to actually place the shortcodes for your custom fields into your post template(s). This is how ACF works, it doesn’t happen automatically (I use ACF 4 and 5 PRO).
So, if you’re using the “style 2” post, you’d need to look at adding your field shortcodes intto the style 2 theme files in your /newspaper/ root.
If using post template 2, try placing your shortcode(s) into
single_template_2.php
loop-single-2.php
where you want them to appear.
This is described in the ACF docs:
http://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/
-
This reply was modified 10 years by
simchris.
Hello
I was wondering if you could be so kind to help me. If you look at my home page at (no spaces)
p a r a d i s e f o u n d t o u r s. c o m
I added a custom “blurb” using Advanced Custom Fields. For the life of me I couldn’t figure out a different way (block quotes? I don’t know)
What I did was edit:
includes/modules/td_module_1.php <-archives
includes/modules/td_module_2.php <- home page categories
includes/modules/td_module_3.php <- home page featured.
I added this code:
<!-- Start of Custom Blurb on Archive Tour Page Categories -->
<p class="blurb"><?php the_field('tour_blurb', $this->post->ID); ?></p>
<!--/post-title - price class added -->
<div class="retailprice">Retail Price: $<?php the_field('retail_price', $this->post->ID); ?></div>
<div class="price">Our Price: $<?php the_field('price', $this->post->ID); ?> USD</div>
<div class="disclaimer">*No additional fees or taxes on checkout!</div>
<!-- End of Custom Blurb on Archive Tour Page Categories -->
And I removed the exerpt code from td_module_2.php
The problem that I am now having is the code shows up when I try to add block 3 or block 5 to the sidebar using a widget. http://www.screencast.com/t/3lDYWcVNk
Could you please spare an if statement? That just shows this code on td_module_1.php, td_module_2.php td_module_3.php and NOT in the blocks within the sidebar widget, is that possible?
Thank you so much
Hi again,
Nearly there, all is fine but I have an error message on : Homepage latest articles/Post loop settings/ :
Warning: Invalid argument supplied for foreach() in /home/infocred/public_html/stock-newswire.com/wp-content/themes/Newsmag/includes/wp_booster/td_metabox_generator.php on line 34
This warning is displayed between “post type” and “sort order”, and indeed I can’t open the drop down menu on “sort order”.
I have done all plugins udpated, including latest WP version. And here is below the pasted code from my td_metabox_generator.php if it can help :
************************************************
<?php
/**
* generates the metaboxes used on pages that have loops (the filters of the loop)
* Class td_metabox_generator
*/
class td_metabox_generator {
protected $mb;
public function __construct($mb) {
$this->mb = $mb;
}
/**
* creates the fields with return of homepage_filter_get_map() array
* @param array $array_for_fields
*/
function td_render_homepage_loop_filter($array_for_fields = array()){
$arry_params = $array_for_fields[‘params’];
$buffer_field = ”;
foreach ($arry_params as $array_field) {
$buffer_field = ‘<div class=”td-meta-box-row”>’;
switch ($array_field[‘type’]) {
case ‘dropdown’:
$this->mb->the_field($array_field[‘param_name’]);
$buffer_field .= ‘<span class=”td-page-o-custom-label” >’ . $array_field[‘heading’] . ‘</span>’;
$buffer_field .= ‘<div class=”td-select-style-overwrite”>’;
$buffer_field .= ‘<select class=”‘ . $array_field[‘class’] . ‘ td-panel-dropdown” name=”‘ . $this->mb->get_the_name() . ‘”>’;
//creating options for select
foreach ($array_field[‘value’] as $select_option_key => $select_option_val) {
if($this->mb->get_the_value() == $select_option_val) {
$var_selected = ‘ selected=”selected” ‘;
} else {
$var_selected = ”;
}
$buffer_field .= ‘<option value=”‘ . $select_option_val . ‘” ‘ . $var_selected . ‘>’ . $select_option_key . ‘</option>’;
}
$buffer_field .= ‘</select>’;
$buffer_field .= ‘</div>’;
if (!empty($array_field[‘description’])) {
$buffer_field .= ‘
<span class=”td-page-o-info”>’ . $array_field[‘description’] . ‘</span>’;
}
break;
//default : textfield
default:
$this->mb->the_field($array_field[‘param_name’]);
$value_input = $this->mb->get_the_value();
if (!empty($value_input)) {
//
} else {
$value_input = $array_field[‘value’];
}
$buffer_field .= ‘<span class=”td-page-o-custom-label”>’ . $array_field[‘heading’] . ‘ </span>
<input type=”text” class=”‘ . $array_field[‘class’] . ‘ td-input-text-backend-generic-filter” name=”‘ . $this->mb->get_the_name() . ‘” value=”‘ . $value_input . ‘” />’;
if (!empty($array_field[‘description’])) {
$buffer_field .= ‘
<span class=”td-page-o-info”>’ . $array_field[‘description’] . ‘</span>’;
}
break;
}
$buffer_field .= ‘</div>’;
echo $buffer_field;
}
}
}//end class
***********************************************
Please advise what to do, with thanks in advanced.
You need a plugin for that, free or premium. I am using qtranslate-X on my http://www.photocommand.com, which is also complemented by WPBakery Visual Composer & qTranslate-X, Yoast SEO & qTranslate-X, Advanced Custom Fields: qTranslate as those plugins gave me those options.
If I was starting today, I am not sure I would use qtranslate-X (I read it is a hard one to uninstall if you need to and it is not the most SEO friendly (take care when setting your URLs in the language implementation options).
-
This reply was modified 10 years by
JCAires.
Hello Janus,
I understand the idea, it’s a good one actually but unfortunately not so easy to implement. Maybe you can find a plugin to do it something like https://wordpress.org/plugins/advanced-custom-field-widget/screenshots/ and maybe an add-on https://wordpress.org/plugins/advanced-custom-fields-widget-area-field/
We haven’t tested these plugins but maybe they will get you where you need. The alternative method, the coding one, is much more complicated. You will have to create your very own custom widget to pull information from a custom field. It will be no easy task and it will require coding knowledge and quite a bit of time. To create a custom widget http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-wordpress-widget/, you have to create a custom plugin: http://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/ and then create your code to pull info out of the custom field.
I hope this helps
Thank you!
Hello,
You can hide them on specific posts using custom css code or you can also use a plugin like Advanced Custom Fields and use this method to do it: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/
Thanks.
You can control the excerpt for both modules and RSS from the aptly named ‘excerpt’ field at bottom of each post you do.
If you don’t want to do that you could use Advanced Custom Fields (ACF), create custom data field for RSS; then build a custom RSS feed based on “page” (Google how to build custom RSS for WP); then insert that ACF field in the description tag in your custom RSS.
Probably simpler to manually edit your excerpt field for each post — which is what I do when I have in-post sub-head or some kind of intro text which is not what I want showing in social media, modules and RSS. The excerpt field in WP posts is what populates the description field in your META data, RSS, etc.
Hope that helped!
Chris
I created a field in Advanced Custom Fields plugin and tinkered with loop-single.php and added the code
<p><?php the_field('price'); ?></p>
And it showed up, Great! but that was just a test.
Could you please guided me where I can insert it after the excerpt on the blocks on my homepage (blocks 4 and 5) and of course the category and tag pages. Is that the archive template?
Also would you have any handy css code that I can play with and adjust the style, perhaps something to start me off with…
thank you so much!
oh, I have installed Advanced Custom Field and read the post: https://forum.tagdiv.com/topic/where-do-i-insert-advanced-custom-fields/
So where do insert for the blocks, after the excerpt appears?
thank you
Hi Medium,
I’ve added your request on our list and we will consider it. Until then you can edit your plugin version here ..\wp-content\plugins\td-speed-booster\td-speed-booster.php and add this line: 'advanced-custom-fields/acf.php' like this: http://screencast.com/t/LpflDkB8oh then the ACF plugin will not be treated as incompatible anymore.
Thanks for the message!
Probably best to use something like Advanced Custom Fields and make a custom field set where you can paste in the articles you want to link to manually, then put the shortcode for that at bottom of the post template(s) you’re using.
There might be a plugin for this, but I have not seen one.
Hi
In system status shows
Speed Booster v4.1 – Disabled – incompatible plugin detected: advanced-custom-fields/acf.php
Any idea? We are using Advanced Custom fields for important data of entry
OK!!
Finally I found it!! I can’t believe I found this almost by mistake! Just when I was looking for another WP plugin I found this: http://support.advancedcustomfields.com/forums/topic/visual-composer-plugin-conflict/
Very bad of ACF to have a solution only for the ones who buy the pro version!! Very bad really! The issue was created by the ACF plugin! I removed it, I don’t think I will need it anyway. Problem solved!!
YAY!
Hi,
You can hide them on specific posts using custom css code or you can also use a plugin like Advanced Custom Fields and use this method to do it: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/
I will add this on our request list and we will consider it for future updates if we decide to change theme ads system.
Thanks
You can’t have html in the WP titles for a post.
You can edit WP to change behavior in the templates, where what “prints on page” pull from dbase and post meta has style applied.
You can also write HTML in the text editor for posts.
You can also setup custom field, such as with Advanced Custom Fields, with a custom field for a title; then change your template to “print” that field, and NOT the main title field; then rest of site would pull the default title.
Hope that at least pointed you in some direction.
I think this might be possible using a select query. You will have to troubleshoot it yourself though.
function get_meta_values( $key = '', $type = 'post', $status = 'publish', $author = '' ) {
global $wpdb;
if( empty( $key ) )
return;
$r = $wpdb->get_col( $wpdb->prepare( "
SELECT pm.meta_value FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
WHERE pm.meta_key = '%s'
AND p.post_status = '%s'
AND p.post_type = '%s'
AND p.post_author = '%s'
", $key, $status, $type, $author ) );
return $r;
}
Then in the author.php you do
$author_id = $part_cur_auth_obj->ID;
$total_views = get_meta_values( 'post_views_count', 'post', 'publish', $author_id );
This will return an array of data. You can manipulate this data howsoever you want.
For custom user profile fields, I think you can use Advanced Custom Fields plugin.
-
This reply was modified 11 years by
shubhra.
Sorry if this has already been covered – i’ve been searching the forums for hours and can’t find my answer.
I have some very simple advanced custom fields which I want to include in a post. In which filed do I put the following code so that it appears under the article content?
<?php $field = get_field($twitter); ?>
Well, they kind of already have … on various threads.
Right now the *only* solution with Newsmag if you have this CPU spiral of doom is to use the shim plugin, and use VC as little as possible beyond the development portion of your home page. Make sure you have a lot of memory allocated to WordPress (at least 256MB from the wp-config.php file in addition to php.ini setting; you must do both!).
We started to see minor spikes once 4.4.2 came out. Prior to that zero issues. Right now we can use it, but anything later not so good. I can’t imagine if WP Bakery haven’t addressed this ins the 4.5x versions, that they still don’t “get it” and are not solving it — seems to be a “if 90% of people can use, the other 10% oh well …” which isn’t great.
Right now TagDiv is focused on (based on posts I’ve seen):
a) Newspaper 5 w/ features of Newsmag + better grid + new version of API.
b) Next Shim beta for use with Newsmag *and* Newspaper.
c) Newsmag 1.8 with bug fixes and minor updates/tweaks.
d) Dev work on possible alternative to using Visual Composer.
So — at the moment if your site dies with VC 4.42 immediately, then it’s clear you might need to go back one more iteration, and/or stick with 1.6 of Newsmag vs 1.71.
I have 2 sites still working with 1.6 and 4.42 without shim, and doing okay, but they are fairly low traffic sites. I have 3 sites on 1.71 with VC442 and the shim, and 2 of these are our larger main traffic sites which were killing MySQL in batches of every 10 minutes or so going from green to yellow to red, and back. Then CPU death.
Not sure any of that helps … not much TagDiv can do beyond the shim, and possibly providing earlier versions of VC to try for your system. Since they don’t develop VC, it’s not something they can “fix” for anybody beyond the reports they have provided to the Bakery folks as a developer/licensor in hopes of solution (and yet to see one).
Some theme devs are already leaving VC in favor of in house solutions or simpler things like Siteorigin builder (free/open source), etc. (( We’re using Page Builder by SiteOrigin with a lean WP home brew Bootstrap 3 theme for a client reporting system along with Advanced Custom Fields, and works well so far for that … )).
Anyway…. I’m sure TagDiv folk will have some reply, but likely not far different from the above rantings 🙂
Of course, it’s possible that the next version of Visual Composer will be better “optimized” …. frankly, I’m amazed they are not working with an example “DOA” server setup, reading the error logs, and trying to find what bit of code is causing the death spiral, and then FIXING it. But I’m behind on stuff for my own business, so can’t really point fingers on that 😉
Advanced Custom Fields plugin, then place the text shortcode into the template(s) where you want such code to appear; would be best way.
Hi,
Unfortunately that is not possible at the moment, the theme doesn’t have an option for that. You can hide them though on specific posts using custom css code or you can also use a plugin like Advanced Custom Fields and use this method to do it: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/
I will add this on our request list and we will consider it for future updates.
Thanks