-
AuthorPosts
-
December 2, 2016 at 5:07 pm #719820
Helle Everybody
id like to have your social-share buttons somewhere in every single-event.
Example:This post-type comes from “Events Calendar” from Modern Tribe
Yeet recommended this solution but it doesnt work:
add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) {foreach($metabox as &$meta) {if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') {$meta['page'][] = 'events';}} return $metabox;}
I tried “events” as well as “event” – but none of them did the job.
I also flushed permalinks and the cache.If we can make the ALB work for this CPT i have to add the Social-Share-Element manually to appr. 300 posts.
Is there a shortcut?
Or maybe a way to make it default?Regards Marcus
December 6, 2016 at 12:48 am #720759Hey MarcusJeroch,
Try using this code instead and add it to functions.php:
add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) { foreach($metabox as &$meta) { if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') { $meta['page'][] = 'tribe_events'; } } }
As for the shortcut in adding Social Share to each event, you can add this code in functions.php:
function add_social_share() { echo "<br>"; echo do_shortcode("[av_social_share title='Share this entry' style='' buttons='' custom_class='']"); }
Let us know if this helps. :)
Best regards,
NikkoDecember 7, 2016 at 8:13 pm #721692Hello Nikko
sorry, but none of your suggestions worked.No errors occurred but nothing changed.
No ALB , no share buttons as defaultThis is the content of my functions.php
<?php /* * Add your own functions here. You can also copy some of the theme functions into this file. * WordPress will use those functions instead of the original functions then. */ function enqueue_parent_theme_style() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style'); /* Proper way to enqueue styles and scripts */ function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scripts', 'theme_name_scripts' ); /* Activate Avia debug mode */ add_action('avia_builder_mode', "builder_set_debug"); function builder_set_debug() { return "debug"; } add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) { foreach($metabox as &$meta) { if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') { $meta['page'][] = 'tribe_events'; } } } function add_social_share() { echo "<br>"; echo do_shortcode("[av_social_share title='Share this entry' style='' buttons='' custom_class='']"); }
Regards Marcus
December 11, 2016 at 6:37 am #722780Hi,
Please post the login details here so that we can check it further. For the social share, please use this instead.
add_action('tribe_events_single_event_after_the_content', 'tribe_events_single_event_after_the_content_mod'); function tribe_events_single_event_after_the_content_mod() { echo do_shortcode("[av_social_share title='Share this entry' style='' buttons='' custom_class='']"); }
Best regards,
IsmaelDecember 12, 2016 at 4:14 pm #723211Hi Ismael
thanx, that worked.Since we solved that there is no need to make the ALB work for events.
If i need it one day i`ll come back.
Regards marcusDecember 13, 2016 at 2:31 pm #723717Hi Marcus!
You mentioned you need further assistance. How can we help? :)
Best regards,
YigitDecember 13, 2016 at 6:28 pm #723899Hello Yigit
the code Ismael provided looks as if the share buttons will be echoed at the bottom of content:
add_action(‘tribe_events_single_event_after_the_content
In fact it ends up in another <div> and that causes that the boxes containing the eventdata will be pushed out of the visible screen if you look on a mobile phone.
The only thing you see is the share buttons taking the whole screen-widthI made a workaround by CSS but for sure this is not a clean solution.
The CSS is:
.shareva {
clear: both;
margin: 60px 0 170px 0 !important;
position: relative !important;
}Can you please help us to find a proper solution?
Regards Marcus
December 16, 2016 at 2:36 pm #725333Hi Marcus,
Sorry for the late reply.
Can you please post a screenshot showing the issue and a link to your page?
You can upload your screenshots on imgur.com or Dropbox public folder and post the links hereBest regards,
YigitDecember 23, 2016 at 4:08 pm #727983Hi Yigit
screenshot shows this URL on a mobile:Here is the screenshot:
https://drive.google.com/open?id=0B-VtEOLANbaCNl9tN1ZJb0V3YncREMEMBER:
I made a dirty work around with the CSS mentioned above and i removed the CSS specially for the Screenshot.
Of couse i have to put the CSS back in charge again because i dont want my users to see crashed pages.Another Thing
The Codes provided from Ismael and Nikko to add ALB to events do have two results:
1: ALB does not show up in Events
2: ALB vanished from Blogposts
This of course is the wrong directionRegards Marcus
December 28, 2016 at 4:20 am #728345 -
AuthorPosts
- You must be logged in to reply to this topic.