- NewspaperHeader ads
- NewspaperSidebar ads
- NewspaperArticle Ad
- NewspaperPost template ads
- NewspaperAbove footer ads
So I created a new single_template based on the single_template_2.php file and the loop-single-2.php.
I am able to get it working. Basically I am trying to get a static do_shortcode(‘[ td_block_video_youtube playlist_title=”My YouYube Playlist” playlist_yt=”8hAwUt8-G34, F9S49fUqbVQ, TUdVeZ1pbuc” playlist_auto_play=”0″ ]’) with the shortcode directly under where the content is echo.
Jumping down to the get_content portion of the loop this is my code:
<?php echo $td_mod_single->get_content();
$vidarray['playlist_title'] = $td_mod_single->post->post_title;
$vidarray['playlist_yt'] = 'lxYtiIHcpVg, 5pVxWdnInWY, 2zUANqLVbhM, Q0R_K3QSb6o, 2yCfV9qL42k';
$vidarray['playlist_auto_play'] = 0;
videoSC = '[vc_row][vc_column][td_block_video_youtube playlist_title="TITLE" playlist_yt="'.$vidarray['playlist_yt'].'" playlist_auto_play="0"][/vc_column][/vc_row]';
echo do_shortcode($videoSC);
?>
Hi
To use diferent modules on the category page you will need custom modifications in theme’s core files and I cand provide a quick solution for that. Instead you can use blocks from Visual Composer, which are built from different modules, following this steps:
– first you need to set the block in VC and add a specific class for it as it’s necessary a custom css for this particular case: http://screencast.com/t/RmC19Befc
– switch in backend editor copy this code: http://screencast.com/t/u3Ca4vZrRXda http://screencast.com/t/oej5d5DGAkH
– insert this code in category.php file like here: http://screencast.com/t/SRIR9kv4
<?php echo do_shortcode('[vc_row][vc_column width="2/3" el_class="class"][td_block_14 limit="4" category_id="6" ajax_pagination="next_prev"][/vc_column][/vc_row]');?>
After that add this css in theme panel > custom css:
.class{
width: 100%!important;
}
The result should be like here: http://screencast.com/t/mjgyiqSCKn
This code will display the same block on all categories pages. If you need different blocks depending by category it’s need a set of conditions like this: http://screencast.com/t/kDrGBrUE
<?php
if (is_category(13)) {
block for category with id 13 goes here
}
elseif (is_category(14)){
block for category with id 14 goes here
}
?>
To get the category id follow this link: http://screencast.com/t/RZuMUg8oM01
Hope this help.
Thanks!
I have tried several different methods to use the shortcode td_block_video_youtube in my custom php template. what do I need to do in order to utilize that shortcode?
Thanks
Buna
Blocurile temei pot fi folosite doar daca ai Visual Composer activ. Chiar daca folosesti functia do_shortcode() pentru renderizarea shortcodurilor layoutul va fi afectat fiindca lipsesc unele clase din de css din VC.
Multumesc.
Hi grupoinnovate,
Yes, it is possible. You can use the custom ad spots: https://forum.tagdiv.com/custom-ad-spots/ and place the ad like shown in the documentation or if you know your way around php a bit you can use the do_shortcode function and add your code in the theme files. – https://developer.wordpress.org/reference/functions/do_shortcode/
Thank you!
Hello,
You can use the custom ad spots: https://forum.tagdiv.com/custom-ad-spots/ and place the ad like shown in the documentation or if you know your way around php a bit you can use the do_shortcode function and add your code in the theme files. – https://developer.wordpress.org/reference/functions/do_shortcode/
Thank you!
Hi,
@bsullivan You can add target blank for Source and Via url in td_module_single_base.php file – http://screencast.com/t/qrUN77YZWF64
@cookingpanda You can edit the post template that you use(loop-single or single_template) and use do_shortcode function to place a custom as above the featured image.
I guess that you are still using version 4 of the theme so please check this topic as reference – https://forum.tagdiv.com/topic/custom-ad-between-breadcrumb-and-title/
Thanks!
Hi Lucian,
I just upgraded to Newsletter v6 and I couldn’t find the right place to tweak the code so that the shortcodes are working in the category description again. Could you maybe update your solution so that it works in v6? That would really be much appreciated.
Edit: I just answered my own question. Found the right place to change in includes/wp_booster/td_category_template.php. There change line 175 to
return '<div class="td-category-description"><p>' . do_shortcode($this->current_category_obj->description) . '</p></div>';
Thanks & best,
Torge
-
This reply was modified 10 years by
Torge.
Hi,
For the category template you will need custom modifications to place ads in the content, please check this solution – https://forum.tagdiv.com/topic/how-can-add-horizontal-sidebar/#post-62563
Also if you want to place a custom ad just just bellow the pagination on a category page you can edit the category.php and use do_shortcode function like this – http://screencast.com/t/lr17J6O36C – http://screencast.com/t/rW0jkhWqlrTS or if you want this just above the footer – http://screencast.com/t/HqvjtO1x – http://screencast.com/t/VXWereyztO
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?>
In page content you can add ads using Ad Box block – http://screencast.com/t/DBn7hgVVXf and for post pages thare are specific spots in Theme Panel > Ads where you can paste your code(top, inline, bottom) – https://forum.tagdiv.com/article-ads/
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
Hi Alin,
i have to ask you sorry because when i looked at your screencast i didn’t realized you also posted the hide_ad code.
By the way, now i did it exactly as you posted and i have this code in the td_block_ad_box.php file:
$buffy = '';
if (!get_field('hide_ad')) {
$buffy .= '<div class="td-a-rec td-a-rec-id-' . $spot_id . $align . ' '
. ((!empty($ad_array['disable_m'])) ? ' td-rec-hide-on-m' : '')
. ((!empty($ad_array['disable_tp'])) ? ' td-rec-hide-on-tp' : '')
. ((!empty($ad_array['disable_p'])) ? ' td-rec-hide-on-p' : '')
. '">';
$buffy .= do_shortcode(stripslashes($ad_array['ad_code']));
$buffy .= '</div>';
}
//print_r($ad_array);
return $buffy;
}
}
But this does not make my ads to desappear (my custom ad field is named the same)… they are still there (all of them).
-
This reply was modified 10 years by
reloaded.
Hi
You can use use a text block from Visual Composer to create the descriptions then edit the category.php file and use the do_shortcode() function to display the block’s shortcode on the category page: http://screencast.com/t/cc9DuvAxH To get the shortcode please follow this links: http://screencast.com/t/ojfV9QRc – http://screencast.com/t/07CsJiFJT
The result should be like here: http://screencast.com/t/jVCmCPPwrHri
Let me know how it goes and provide more details if you still need assistance on this.
Thanks!
Hi
To display a different header ad depending by category you need to edit the ads.php file and add a set of conditions like here: http://screencast.com/t/bFwpJ40a2D
if (is_category('New Look 2015')){
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');
}elseif (is_category('Street Fashion')){
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_2"]');
}elseif (is_category('Style Hunter')){
echo do_shortcode('[td_block_ad_box spot_id="custom_ad_3"]');
}
You need to replace the current categories names with your names. This code will display different header ad on the category page. If you want the same implementation for posts you need to use this function: in_category(): https://codex.wordpress.org/Function_Reference/in_category
Thanks!
-
This reply was modified 10 years by
Andrei L..
Hi
To display the pagination above the article button ad you need to remove the the ad from post content: http://screencast.com/t/PWgzx852 then place the ad after the pagination function in posts’s template file, like this: http://screencast.com/t/pgCbyqSPF You can use the do_shortcode(‘ ‘) function and insert the ad shortcode from VC: http://screencast.com/t/W4SFKPnoShn – http://screencast.com/t/lqaJxdVdMee in every post template files corresponding for the post template used.
To obtain a similar pagination you will need lots of customizations in theme’s core files and I can’t provide a quick solution now. You can use this example to customize the pagination on posts by adding this parameter: ‘next_or_number’ => ‘next’, here: http://screencast.com/t/hkqJljKyxr3 and remove this code: http://screencast.com/t/87kGUcin5YQN – result: http://screencast.com/t/8THEIGR5 If you want a different implementation for pagination and you’re not aware of the steps you need to take in this regard please consider hiring a developer or a freelancer from sites like: http://studio.envato.com/ to do this for you.
Thanks!
Hi
You can customize the tag page from theme panel > template settings > tag template: http://screencast.com/t/xPrmMPUUQy The theme allow you to change the module used for the tag page, the sidebar position and which sidebar will be used for the tag page can be controlled from there.
The theme wasn’t designed to display blocks on tag page, but you can use do_shortcode() function to achieve that, like in this example: http://screencast.com/t/ASDXrbTpjTLM
<?php echo do_shortcode('[td_block_big_grid category_id="63"]');?>
To get the shortcode create a blank page, add the block which you want to display on tag page: http://screencast.com/t/6rMkvdLh then switch in backend editor, copy this code: http://screencast.com/t/zQKx94rg1 and paste it inside the function.
The result should be like here: http://screencast.com/t/GakHkD6yTT
Let me know how it goes.
Thanks!
-
This reply was modified 10 years by
Andrei L..
Hi,
You can add a custom ad for the post template that you use, just edit the file and use do_shortcode function – http://screencast.com/t/txPjkFaS
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?>
There are many topic about how to add a custom ad, as reference:
https://forum.tagdiv.com/topic/move-the-bottom-article-ad-spot-below-the-share-bar/
https://forum.tagdiv.com/topic/move-bottom-article-ad/
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
I figured it out. I used visual composer to add block and then switched to classic mode and g otcode.
🙂
<?php echo do_shortcode('[vc_row][vc_column][td_block_16 custom_title="Name of block title" category_id="XYZ" limit="5"][/vc_column][/vc_row]'); ?>
Tnx anyway
-
This reply was modified 10 years by
croboy.
Hello,
In order to place a custom ad in a category page, you will have to alter the theme files. You can use a ‘do_shortcode’ function to use your custom ad spots from the theme panel. For example use the code like this:
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?> and place it in the category template you use: http://screencast.com/t/hEJfFrM6 (mine was a style 4)
result: http://screencast.com/t/ZuKiMZmS
Thanks.
-
This reply was modified 10 years by
Bogdan B..
Hello,
The theme has a few options to insert ads. Please read the doccumentation on how you can use ads: https://forum.tagdiv.com/header-ad/ (there are 8 sections on ads)
For pages you can use visual composer’s ad box element.
Headers have their own ad space you can use. If you want to place another ad besides the one provided by the theme you will have to alter the theme core files.
If you want to use the code method for example in the category pages, you can use a ‘do_shortcode’ function and set it to use one of the custom ad spots from the theme panel:<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?> and place the code in the corresponding category file: http://screencast.com/t/LgZK8Zys2Uw
I hope this helps.
Thanks.
-
This reply was modified 10 years by
Bogdan B..
Hello,
Unfortunately the theme does not have an option for it, so you have to use the code method. You can use a ‘do_shortcode’ function: <?php echo do_shortcode('your shortcode here');?> and place it in the post template you use on your post (loop_single.php if it is the default one)
Every post template has a file to go with it. The default is without a number to it. The others correspond to their post template number.
You can add for example a trending now block in posts by editing the file template corresponding with the post template used, and add this line of code like here: http://screencast.com/t/Jf5SKCFx5Pka – http://screencast.com/t/7j8xHNyc6
<?php echo do_shortcode('[vc_row][vc_column][td_block_trending_now][/vc_column][/vc_row]'); ?>
As for the ads, the theme uses adsense code and every other custom ones have to be done by using this method here: https://forum.tagdiv.com/using-other-ads/
I hope this helps
Thanks!
-
This reply was modified 10 years by
Bogdan B..
Oh never mind…i solved it by adding some custom JS and CSS.
http://jsfiddle.net/livibetter/HV9HM/
This is really helpful if anyone else wants to make the newsticker sticky
Custom js
jQuery(document).ready(function($) {
function sticky_relocate() {
var window_top = $(window).scrollTop();
var div_top = $('#sticky-anchor').offset().top;
if (window_top > div_top) {
$('#sticky').addClass('stick');
} else {
$('#sticky').removeClass('stick');
}
}
$(function () {
$(window).scroll(sticky_relocate);
sticky_relocate();
console.log("hello");
})
});
Custom CSS:
#sticky.stick {
position: fixed;
top: 100px;
width: 860px;
}
Copy both stuff and place it in the themepanel. Add the following elements anywhere to echo the newsticker
<div id="sticky-anchor"></div>
<div id="sticky">
<?php echo do_shortcode('[td_block_trending_now]');?>
</div>
Hi,
The theme doesn’t have an option to make a specific blocks sticky. But a solution is to use do_shortcode function and place the Newsticker in the menu. For example if you use header style 1 – http://screencast.com/t/1DhmWTd8GK – http://screencast.com/t/G6ZyfzFQSn – http://screencast.com/t/1rwuAsuGMmE6
Of course enable sticky menu from Theme Panel > Header – http://screencast.com/t/6z8VxLneQe
Thanks!
Hello,
If you have a plugin installed to show a timer in the meta section, you can try to alter the theme files and use a ‘do_shortcode’ function: <?php echo do_shortcode('your shortcode here');?> and place it in the post template you use on your post: http://screencast.com/t/fc7VGtvEqQcz
Every post template has a file to go with it. The default is without a number to it. The others correspond to their post template number.
Thank you!
-
This reply was modified 10 years by
Bogdan B..
Hello diotali,
You can achieve this by choosing one of the 2 post styles containing a top ad: http://screencast.com/t/dYozcI9O
Result: http://screencast.com/t/H6ZtUcnf6
Other post types will display an article top ad but only after the featured image.
If you do not want to use the 2 post types, you will need to do a bit of modification to the core files.
Use this code:
<?php echo do_shortcode('[td_block_ad_box spot_id="custom_ad_1"]');?>
And you have to place it in the post template you want to use: http://screencast.com/t/e5QwytfYiXu
Every post template has a corresponding file. single.php is the default template. Single template 1 is template 1, single 2 is template 2 etc.
I hope this helps.
Thanks.
Hi,
You can create you block in a page using Visual Composer, filter options, sort order, pagination – http://screencast.com/t/uC6tfp2w
Then edit the footer template that you use and use do_shortcode function – http://screencast.com/t/koR5Duvgj1 – http://screencast.com/t/0XCw4vunOH
<?php
if(is_single()) {
echo do_shortcode('[vc_row][vc_column][td_block_3 limit="6" ajax_pagination="load_more"][/vc_column][/vc_row]');
}
?>
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
Hi, I want to add a block with infinit scroll in footer section only in article page below section. If you visit mashable.com/2014/10/09/google-nexus-shamu-report this page you will see an auto infinit scroll section bellow article in the footer area. I like to achieve similar feature (screenshoot) . You told that it can be done by adding a do_shortcode function.
But as i am not a techy guy can help me providing screenshot & exact code (for block 3 with latest articles) that i can paste. Please help.
Thanks in advance.
