- NewspaperCustom Fields Support
- NewspaperIntroduction to CPT and ACF with Newspaper Theme
- NewspaperCreate a form contact page
- NewspaperUsing the Theme Translations with WPML
Hi,
I’ve created a field by Advanced Custom Fields and would like to use this value on top of the title in modules. I can change the date to the top but I need the custom field there. How can I do it?
Here you can see the problem:
https://drive.google.com/file/d/0B8T_TzC3P4KbbGxDeTdyOWQ5ZDA/edit?usp=sharing
Thanks
Hi,
You could do this by adding the code on the template of the page you want to have this code, for example if I understood well you want this on post pages and enable this only if the post belongs to a certain category and use a plugin like Advanced Custom Fields to chose when editing the post if to show that widget or not for that post so regarding the category that post belongs you can chose if that widget to be displayed or not.
Here is how you can do it, follow this topic: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
If you don’t have basic php/html/css knowledge we recommend you hire a freelancer from sites like: http://studio.envato.com/ if you don’t know how to do it yourself.
Unfortunately we cannot offer custom work as we work hard on the development, updates, fixes and support.
Thnaks
You’re very welcome.
The docs for getting the label of a field as well as the value are here: http://www.advancedcustomfields.com/resources/get_field_object/
This means that for the lines like this:
$data_1 = get_field('2g_network');
That returns only the value. So you would now have
$data_1 = get_field_object('2g_network');
Which returns an object with various keys, including “label” and “value”.
Once you have that object, you could change lines like this:
$to_echo .= $data_1;
to lines that use specific parts of that object.
$to_echo .= $data_1["label"] . ': ' . $data_1["value"];
Have fun!
You need to create a custom field (I use the Advanced Custom Fields plugin for that) called hide_author or show_author. The name doesn’t really matter. Let’s say you use show_author. The default setting now is that it won’t show the author unless the show_author box is checked when creating a post. By default, no author boxes are shown with this setting, but can be enabled for each post by check the new custom field box.
Hi,
Thanks @mehedi!
@sbo
You can use a plugin like Advanced Custom Fields and use the following method or similar way like shown here: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
Or you can create a condition into the category page template and based on category ID you can chose to display certain ads, you can hire a freelancer from sites like: http://studio.envato.com/ to do it for you if you don’t know how to do it yourself.
Hope this helps!
Thanks
Hi,
You can use a plugin like Advanced Custom Fields. You can make it in a similar way like shown here: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
Or you can use css to hide the ad box on the pages you want using a custom css http://screencast.com/t/YWDlx6Ih79 similar to this:
.postid-4228 .td-a-rec-id-content_top {
display: none;
}
Hope this helps!
Thanks
Not all post templates show the captions. (Style 2 does, style 4 doesn’t, haven’t played around with the others.)
I had this same need so I installed the plugin Advanced Custom Fields, added a metabox for photographers, and manually displayed the data saved there after the author. I found this a bit of a complicated process if you’ve never done anything like it and had to do a lot of reading. I can try to walk you through it if you want.
One easy way might be to try a plugin like Better Image Credits, which can take some credit fields and automatically output it at the top or bottom of your post, or other settings.
Got it! 😀 Note to self: don’t rely on Advanced Custom Fields’s have_rows() function to know what post it is if I’m in a module…
For anyone else having a similar problem with ACF: just remember to pass the function the $post object when you see the theme code using $this 🙂
Hi,
You can find the code for subtitle field here http://screencast.com/t/1tvKUKfyo
You could try to move it form post settings or use Advanced Custom Fields plugin to create and custom field where you can edit it like you said it should work although it’s not an easy task so you can try to search the web for a solution to this or hire a freelancer to do it for you if you don’t know how to do it.
Thanks
Hi,
Let’s say I’m using the excellent Advanced Custom Fields plugin. Is it possible to create a field where the user can edit the td_subtitle provided in the post settings that come with the theme? I want to hide that box, but still have access to editing just the subtitle field.
Thanks!
Hi,
You can use a plugin like Advanced Custom Fields. You can make it in a similar way like shown here:
https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
Hope this helps!
Thanks
+1 on Advanced Custom Fields…. been using this for a project and it works very well. There is no conflict unless you create a new template with field that has existing field name… which I don’t think it would let you do anyway.
Hi,
Yes it is possible, you can use “Simple Ads Manager” plugin, read more here: https://forum.tagdiv.com/topic/how-to-block-google-ads-in-some-posts/#post-10776
Or you can do it using “Advanced Custom Fields” plugin and some code, here you have a discussion about this: https://forum.tagdiv.com/topic/how-to-block-google-ads-in-some-posts/
Thanks
Thanks a lot for your answer !
I was thinking to try something like this.
I just wonder how advanced custom field plugin will react, i hope it will not delete existing customfield !!! I will try if you say so 🙂
Hi,
If on your old theme you had some custom fields, all that come from somewhere. If you want you can use a plugin like Advanced Custom Fields https://wordpress.org/plugins/advanced-custom-fields/ this allows you to add custom fields easily.
Hope this help!
Thanks!
Hi,
My version is the 3.0.
I istalled and configured Advanced Custom Fields and
I did this http://screencast.com/t/5FOgXORGMMp and this http://screencast.com/t/A7KWAo2hlNRf and even this http://screencast.com/t/xFyqF7MGDa (for child themes).
I got the same error message.
The line is different from your Screencast figure, the php line for content_inline has “and $tds_inline_ad_paragraph > 0” not showed in your picture [http://screencast.com/t/5FOgXORGMMp].
I tried to remove it, but I got the error message either.
Any clues?
Thanks for your support (and patience).
Hi Marius,
I tried to install Advanced Custom Fields like you suggest in the post [https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-9187], but I believe the instructions are outdated.
I can’t see this image posted by you on Screencast:
Then add this code and !get_field(‘hide_ad’) like here: http://screencast.com/t/5FOgXORGMMpand
AND if i do this: http://screencast.com/t/5FOgXORGMMp
I get this message
Parse error: syntax error, unexpected T_LOGICAL_AND in /home/getro/www/getrao/wp-content/themes/Newspaper-v3/includes/modules/module_modifier/td_module_blog.php on line 41
I’m doing something wrong or the code change since Newspaper Theme Version 3.0?
Regards,
Cybergetro
-
This reply was modified 12 years by
cybergetro.
Hi,
You can simple make this using this plugin: Advanced Custom Fields install it and create a custom field like here: http://screencast.com/t/aCU7n5ns
Then add this code and !get_field('hide_ad') like here: http://screencast.com/t/5FOgXORGMMpand
Done: http://screencast.com/t/6Zd6NCKRKz
You can make similar for the author box to.
Thanks!
Hi,
– You can make that with a custom field with Advanced Custom Fields plugin
– About a gallery slider, we will take a look for future updates. Added to our list.
– This is doable with CSS
Thanks for the suggestions.
Where can I add advanced custom fields in the source code of the template to appear below the post text?
Regards
You might look at the custom fields plugin which lets you add additional fields to your post page and then insert the custom meta fields into your layouts.
http://wordpress.org/plugins/advanced-custom-fields/
Hi,
@dillermand16 is possible with a plugin + custom code, i will give you the right solution step by step.
1. Install this plugin Advanced Custom Fields
2. Create a custom field like here: http://screencast.com/t/DvpIBngoAa
3. Add this code like here: http://screencast.com/t/UQ90sN6CbIj
code:
if( get_field('my-event-date') ) {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_field('my-event-date') . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_field('my-event-date') . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
4. Edit a post and you will have the date filed here: http://screencast.com/t/LRLiZkvujV
5. Done: http://screencast.com/t/LRLiZkvujV
Hope you manage it, if not please reply back.
Thanks!
Hello Radu,
I don’t quite understand your question. I have already indicated where i’ll love to add the labels in the screencasts.
Just so there’s no confusion, i’ll take it from the top.
I’m Using advanced custom fields plugin to create custom fields for my document Category.
I’ve created three fields:
<li>Name of Author</li>
<li>Date of Publication</li>
<li>Name of Publisher</li>
Now ACF Normally posts only the values of the fields to the database and not the Field Names. In a normal post loop i could use echo to display a Field Name Text and then concatenate it with the field value so that my front end would look like this
Field Name: Field Value
due to the $buffy optimisation, i am unable to use echo so i’m looking for a workaround that would enable me add Field Name (Labels) automatically to each Field Value.
Concerning the issue of adding classes to the div, give me the CSS code which you believe will style the solution and i will add it to the CSS.
Like i stated in my last reply, this is a local development server. WordPress installed on XAMPP on my PC, so i can’t give you any link because the site is not live.
I’m looking forward to having this issue resolved and also it takes too long between replies so effectively this issue has taken us four days now. Please see how you can expedite a solution i’d appreciate it much.
Regards,
Effiong