Find Answers and Get Support › Forums › Cera – Intranet & Community Theme › Website Setup › Pages › Buddypress ads inside activity
- This topic has 6 replies, 2 voices, and was last updated 3 years, 10 months ago by Manathan.
-
AuthorPosts
-
MuamerParticipant@mllapan
- 13 Topics
- 33 Posts
Hi, again.
I have one question more.
I am using this code:function buddydev_inject_content_after_n_activities0() { static $current_activity_index = 1; // change $n to the correct number of activities. $n = 7; // After how many activities you want to inject content. if ( $current_activity_index % $n === 0 ) { ?> <li id="advertbuddy" class='activity-item activity-ad-item activity-custom-entry'> <?php echo adrotate_ad(7); ?> </li> <?php // show the activity injected content. } // increment the current index. $current_activity_index ++; } add_action( 'bp_after_activity_entry', 'buddydev_inject_content_after_n_activities' );
That will inject ad code after 7th activity, and it will be 8th activity.
The problem is when other tab is clicked, adsense says avaiable width is zero,0.October 4, 2020 at 11:37 #23889@themodactyl- 0 Topics
- 6587 Posts
Hi @mllapan,
Please note that this issue is related with the customization of a third party plugin, not with the use of your theme. As theme authors, the installation, setting or debugging of third party plugins isn’t part of the support we will provide.
We only share snippet only to solve issues with our theme. Any further request for CSS snippets will have to be part of a defect that needs to be fixed urgently. No snippets will be shared otherwise.
If you want to go further with the customization of your website, we advise that you hire a freelancer to do it for you.
If you’re on a tight budget, we recommend you to require the services from Envato Studio freelancers (https://studio.envato.com/explore/websites-programming). This web platform gives you access to developers who have already experience with theme customizations, and for very competitive prices.
Thank you for your understanding.
October 5, 2020 at 10:58 #23903MuamerParticipant@mllapan- 13 Topics
- 33 Posts
It is about the theme, because it was styled by
FLEX
.
I asked the same question for bbpress, but until today, I did not realized it was the same problem, now I am.Yeah, the theme is built by flex css, and you need to provide fix for responsive ads inside your theme for your customers, or apply the fix to theme update on the
primary
div, as the most of the people use adsense code.I am not the only one, many people asked the same, but they did not realized they have problem with the way of theme styling, and they are trying to change php functions instead:
https://support.themosaurus.com/forums/search/adsense/October 6, 2020 at 13:21 #23992MuamerParticipant@mllapan- 13 Topics
- 33 Posts
This is not about BuddyPress, BBpress, it is also the problem of the single posts, single pages too.
Any adsense on single posts, single pages will push sidebar in the new row, because responsive adsense ad is able to push flex box to full width of the screen.
The problem is calledflex
in the theme.October 6, 2020 at 13:23 #23993@themodactyl- 0 Topics
- 6587 Posts
Hi @mllapan,
Could you provide us with screenshots of your website please? Please don’t hesitate to comment or highlight your screenshots to help us better understand your issue.
Could you share the URL of the exact page so I can investigate on this issue, please? You can post it in your next reply and mark it as private to keep this between us.
Thank you.
October 8, 2020 at 09:15 #24080MuamerParticipant@mllapan- 13 Topics
- 33 Posts
Hi, @themodactyl.
Here is the screenshot.
It does not matter what kind of code is used, even if you use lets say Ads Inserter plugin, once Adsense is inserted into between paragraphs, or into bbpress topic page, or anything inside normal page text, it will stretch primary div into full width of the screen and will push down sidebar under primary div.I am saying this all the time, but seems no one understands me.
It is not about the code I, or anyone else use to inject ads, but about flex styling.For example, if I use width: 600px !important, than, the advertisement will not push sidebar to a new row, under the primary div. but than that is not any responsive advertisement and looks bad on mobile, or if you make it good on mobile, it will look too small on desktop.
We need some javascript or jQuery that will prohibit adsense ads do this with flex css.You can acomplish the same with child theme and using this:
– Put your single post template to have sidebar, add any widget in sidebar.
Use this in functions:add_filter( 'the_content', 'post_ads_1_paragraph' ); function post_ads_1_paragraph( $content ) { $ad_code = '<div class="advertparagraph"> <blockquote>PUT ADSENSE CODE IN HERE OR ADROTATE SHORTCODE.</blockquote> </div>'; if ( is_single() && ! is_admin() ) { return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content ); } return $content; } function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) { $closing_p = '</p>'; $paragraphs = explode( $closing_p, $content ); foreach ($paragraphs as $index => $paragraph) { if ( trim( $paragraph ) ) { $paragraphs[$index] .= $closing_p; } if ( $paragraph_id == $index + 1 ) { $paragraphs[$index] .= $insertion; } } return implode( '', $paragraphs ); }
The code will inject ad after first paragraph.
Than clear the cache, and you will see ad is pushing sidebar under the primary div.October 13, 2020 at 14:10 #24358@themodactyl- 0 Topics
- 6587 Posts
Hi @mllapan,
Thank you for your feedback.
It’s best if we take a quick look at this…
Could you create a new website user for us please? If possible with administrator capabilities so we can make a quick check of your settings.
You can post the user name and password in your next reply and mark it as private to keep this between us.Could you share the URL of the exact page so we can investigate on this issue, please? You can post it in your next reply and mark it as private to keep this between us.
Also, are we free to deactivate plugins for our tests? In this case, I invite you to make a backup before we investigate your website further in order to make sure you don’t loose any data if something goes wrong.
Thank you.
October 13, 2020 at 14:45 #24359 -
AuthorPosts
Hi there,
This topic has been inactive for a while now so we will be closing it to keep the forum tidy. Don't hesitate to create a new topic if you still need help and we'll be glad to help you!
Best regards,
The Themosaurus team.
The topic ‘Buddypress ads inside activity’ is closed to new replies.