Hello, first of all congratulate you on the marvelous theme and great support you give, I’m very happy.
My question is this. When configuring advertising through article, you must specify a paragraph number. It can be configured to target advertising in half the article automatically? It depends on paragraphs having the article, the advertising would more above or below. If I could automatically recognize paragraphs and place advertising in half, would be perfect
Regards and thanks again
hi,
you have to this from code: http://screencast.com/t/imY53Nhr70
if you are not a programmer I advice you to hire one for this task.
Thanks for you message.
Radu A.
I am not a programmer too, if someone found the solution could you post here to share?
Thanks
Hi,
Here is a solution: http://screencast.com/t/JhEy6E8su
Replace this with the code above: http://screencast.com/t/juOEmOlarAY
if (td_util::is_ad_spot_enabled('content_inline') and is_single() ) {
$content_buffer = ''; // we replace the content with this buffer at the ened
$content = apply_filters('the_content', $content);
$content = explode('<p>', $content);
$halfway_mark = ceil(count($content) / 2);
$first_half_content = implode(' ', array_slice($content, 0, $halfway_mark));
$second_half_content = implode(' ', array_slice($content, $halfway_mark));
$content_buffer .= $first_half_content;
switch ($tds_inline_ad_align) {
case 'left':
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'left'));
break;
case 'right':
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'right'));
break;
default:
$content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline'));
break;
}
$content_buffer .= $second_half_content;
$content = $content_buffer;
}
Share 🙂
I really does not work, I make 2 boxes of “Magic action box” and hits me in advertising
Hi,
The solution is for paragraph or similar, I’m not sure that boxes are counted as paragraph.
What you can do if the solution not work for you is to manage the ads manually on each post, use this shortcode to add the AD anywhere in post:
[td_ad_box spot_id="custom_ad_1"] and use Custom AD 1 from Theme Panel
Thanks!
-
This reply was modified 12 years by
Marius.
Hi,
I found that is the article is too short, the in-line ads will very close to bottom ads
Is there any mehtod to not showing inline ads if the article is too short, e.g. not showing inline ads if paragraph is less than 6.
Thanks
Hi,
if you are familiar with coding / editing: http://screencast.com/t/ish3IXH6
I’ve added this to our todo list to be implemented as a theme feature in the panel but it will take some time until we add it.
Hope this helps 😉
Radu O.
Thanks so much, I hope these 2 functions,
both inline ads is in the middle of page & too short article will not show inline ads,
can be at the todo list
I hope the hide ads in single post could be in todo list, too
like https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-9187
Hi,
Yes, I agree.
So I suggest if the value is 0, then do the same job as now it does, put the ads on the top of article, so people who don’t want to change will not affect.
If the value is “null” / empty, then put the ads in the middle of article.
Is it not working at 3.9.2 anymore?
I added if (count($content_parts) > 10) { but it just display “Array” instead of content of my blog
http://www.screencast.com/t/bGuB4ekLe
http://www.screencast.com/t/aoO0REJQHU11
Hi,
I had changed the code for put the inline ads in the middle of article, as Marius said.
https://forum.tagdiv.com/topic/article-inline-ad-2/#post-10954
so it may have some different in your test.
I had capture my code in here
http://www.screencast.com/t/bGuB4ekLe
Is there any thing wrong?
Thanks for help
Hi,
I have checked and noticed that you have 2 different parts in your code:
– the get_field function and the condition with the count function http://screencast.com/t/k32E27Y9K3HS .. off course the code for the condition is commented so it dose not matter, although I’m not sure about the get field function
Just to be sure take the code from here https://forum.tagdiv.com/topic/article-inline-ad-2/#post-10954 and replace your own exactly and check to see if works.
I have tested it again and works like it supposed to.
Ex.
My code intd_module_blog.phpfile : http://screencast.com/t/ncFdx3UXX
Result : http://screencast.com/t/VfeSmzCF
If still doesn’t works please try disabling some of the plugins it may be due to a plugin.
Thanks
Hi,
The get_field function is from this post https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-9187
It add a field to control the post show ads or not, because some posts may not suitable for put adsense.
The two line commented because it doesn’t work, I followed the code here https://forum.tagdiv.com/topic/article-inline-ad-2/#post-12911
add if (count($content_parts) > 5) after $content_parts = explode('<p>', $content);
This code is control the inline ads not display if the article is too short, but it doesn’t work
Hi,
yes, I have a clean WordPress, just with newspaper with demo
http://www.enterpr1se.tk/
It doesn’t work
