Article Inline ad

Posted in: Newspaper
Post count: 56

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

Post count: 854

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.

Post count: 56

good, I’m not a programmer and do not really understand, I will consult the internet or I’ll have to put up with.

Thanks for the reply

Post count: 95

I am not a programmer too, if someone found the solution could you post here to share?
Thanks

Post count: 56

Good, if I find any solution the’ll post here, as are several stakeholders. Regards

Post count: 3343

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 🙂

Post count: 56

Thank you very much, with the new code, what paragraph number we have to put in the settings? Or leave it empty?

Post count: 95

Thanks so much, it works


@arsonists
leave it empty is ok

Post count: 56

I really does not work, I make 2 boxes of “Magic action box” and hits me in advertising

http://prntscr.com/3arpp0

Post count: 3343

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.
Post count: 95

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

Post count: 780

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.

Post count: 95

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

Post count: 95

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

Post count: 854

hi,
thank you for your suggestion

Thanks for you message.
Radu A.

Post count: 3343

Hi,
We will implement it if more people require this, what is good for you, can’t usefulness for other.

Thanks for understanding!

Post count: 95

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.

Post count: 3343

Hi,
You are free to customize the code like you want 🙂
Thanks for your suggestion!

Post count: 95

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

Post count: 6600

Hi,

I have checked and seems to work fine in 3.9.2 also, please make sure you have pasted the code corectly and check again.

Thanks

Post count: 95

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

Post count: 6600

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

Post count: 95

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

Post count: 6600

Hi,

Have you tried deactivating the plugins?
Please let me know,
Thanks!

Post count: 95

Hi,

yes, I have a clean WordPress, just with newspaper with demo
http://www.enterpr1se.tk/

It doesn’t work

Viewing 25 posts - 1 through 25 (of 32 total)
You must be logged in to reply to this topic.