Tagged: ismael
-
AuthorPosts
-
April 24, 2017 at 4:16 pm #782402
Hi there,
I have found some entries to create a shortcode for a breadcrumb. I have tried to add a code in my child functions.php file, but I had shot down the system with this step. Repairing was only possible via FTP.
I want to have a shortcode like descripted here:
https://kriesi.at/support/topic/how-to-using-the-breadcrumb-shortcode/At one test page I have already added the shortcode but I want to be attended with my functions.php file.
http://www.bbt-energieberatung.de/energie-beratung/aa-test/ (only to see after login)Greetings Andre
April 25, 2017 at 8:28 pm #783080Hey brandhands,
Here is a tutorial that might help you
If you need further assistance please let us know.
Best regards,
VictoriaMay 3, 2017 at 3:37 pm #787200Hello,
I have tried to copy the function add_shortcode( ‘bread_crumb’, ‘avia_title’ ); in my child theme file of functions.php and commented out the 19th line in the template-builder.php file, but what will happen there after a theme update?
The shortcode at my test page ( http://www.bbt-energieberatung.de/energie-beratung/aa-test/ ) hides, but it doesn’t work. Do I have to copy any content from functions-enfold.php into my functions.php in my child theme folder? If I work directly in the functions-enfold.php file, will it be away after any update, alright?
Greetings Andre
May 4, 2017 at 6:05 am #787592Hi,
You don’t need to modify the template-builder.php file if you use the following shortcode.
add_shortcode( 'bread_crumb', 'avia_title' ); // remove title add_filter('avf_title_args', function($args) { $args['html'] = "<div class='{class} title_container'><div class='container'>{additions}</div></div>"; return $args; });
Use the same [bread_crumb] shortcode.
Related thread:
// https://kriesi.at/support/topic/swap-the-sequance-of-the-bar/#post-653269
Best regards,
IsmaelMay 4, 2017 at 10:00 am #787675Hello,
thanks for the code snippet. I have copied it now into my child folder functions.php and have restored the 19th line in template-builder.php
But my result is still an empty field at my test page. Is there another way to build in the bread_crumb shortcode?
Best greetings,
AndréMay 4, 2017 at 2:08 pm #787809Hi brandhands,
I think the code does not work if the settings here are set to hide.
The show now, and you can adjust to whatever you need.If you need further assistance please let us know.
Best regards,
VictoriaMay 4, 2017 at 2:20 pm #787818Hi,
Or you can disable in settings the breadcrumbs, but copy the whole “avia_title” function to your child theme and comment out this line
if($header_settings['header_title_bar'] == 'hidden_title_bar') return "";
This way they will work, even if the settings are set to hide and will show only where you paste the shortcode.
Best regards,
VictoriaMay 9, 2017 at 10:11 am #790108Hello,
where can I find the whole “avia_title” function?
What have I to write exactly in my functions.php of my child folder?
My aim is described in this picture:
May 9, 2017 at 11:39 am #790173Hi,
You should be able to find avia_title function in functions-enfold.php (line 360-438, in Enfold 4.0.5). Just want to confirm if the screenshot you posted is a page/post that can be edited in the backend? if it is, you might want to edit the page/post then there’s a setting on the sidebar Title Bar Settings which you can set to Display only title. Hope this helps. :)
Best regards,
NikkoMay 9, 2017 at 1:53 pm #790251Hi,
this is a usually page, I want to edit.
I have copied the lines 359-437 (from my functions-enfold.php) into my functions.php of the child folder and commented out the exactly line. It looks now like this:
// if($header_settings[‘header_title_bar’] == ‘hidden_title_bar’) return “”;
If I switch ‘off’ the breadcrumbs in the backend (‘display only title’ or ‘hide both’) then there is nothing to see. Both breadcrumb lines (in the navigation menu, but at the begin of my text-field (where my shortcode is) as well) hide.
If I switch ‘on’ the breadcrumbs in the backend (‘display only breadcrumbs’ or ‘display title and breadcrumbs’) then there are both lines to see.
My aim is to only show the breadcrumb, where my shortcode is placed, but not in the navigation menu.
May 9, 2017 at 3:14 pm #790340Hi brandhands,
Here is the code to remove border
.post-entry-1266 .stretch_full.container_wrap.alternate_color.light_bg_color.title_container { border: none; }
You copied the correct function. There was just one more condition that was relying on theme settings and we don’t want that. Check now :)
Best regards,
VictoriaMay 9, 2017 at 3:43 pm #790383Hi,
the grey line is away now, after inserting to css. (screenshot was made before this) Is it necessary to do it for every post entry later?
The breadcrumb in the navigation menu is there 3 times now.
- This reply was modified 7 years, 6 months ago by brandhands.
May 9, 2017 at 8:49 pm #790580Hi,
Can you please paste us the exact function you are using so we can be able to track where the problem is please?
Best regards,
BasilisMay 10, 2017 at 9:58 am #790954The content in my functions.php (child folder) is actually this:
<?php
/* Write your awesome functions below */add_theme_support(‘avia_template_builder_custom_css’);
// remove title
add_filter(‘avf_title_args’, function($args) {
$args[‘html’] = “<div class='{class} title_container’><div class=’container’>{additions}</div></div>”;
return $args;
});//advanced title + breadcrumb function
if(!function_exists(‘avia_title’))
{
function avia_title($args = false, $id = false)
{
global $avia_config;if(!$id) $id = avia_get_the_id();
$header_settings = avia_header_setting();
// if($header_settings[‘header_title_bar’] == ‘hidden_title_bar’) return “”;$defaults = array(
‘title’ => get_the_title($id),
‘subtitle’ => “”, //avia_post_meta($id, ‘subtitle’),
‘link’ => get_permalink($id),
‘html’ => “<div class='{class} title_container’><div class=’container’><{heading} class=’main-title entry-title’>{title}</{heading}>{additions}</div></div>”,
‘class’ => ‘stretch_full container_wrap alternate_color ‘.avia_is_dark_bg(‘alternate_color’, true),
‘breadcrumb’ => true,
‘additions’ => “”,
‘heading’ => ‘h1’ //headings are set based on this article: http://yoast.com/blog-headings-structure/
);if ( is_tax() || is_category() || is_tag() )
{
global $wp_query;$term = $wp_query->get_queried_object();
$defaults[‘link’] = get_term_link( $term );
}
else if(is_archive())
{
$defaults[‘link’] = “”;
}// Parse incomming $args into an array and merge it with $defaults
$args = wp_parse_args( $args, $defaults );
$args = apply_filters(‘avf_title_args’, $args, $id);//disable breadcrumb if requested
//if($header_settings[‘header_title_bar’] == ‘title_bar’) $args[‘breadcrumb’] = false;//disable title if requested
if($header_settings[‘header_title_bar’] == ‘breadcrumbs_only’) $args[‘title’] = ”;// OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
extract( $args, EXTR_SKIP );if(empty($title)) $class .= ” empty_title “;
$markup = avia_markup_helper(array(‘context’ => ‘avia_title’,’echo’=>false));
if(!empty($link) && !empty($title)) $title = ““.$title.”“;
if(!empty($subtitle)) $additions .= “<div class=’title_meta meta-color’>”.wpautop($subtitle).”</div>”;
if($breadcrumb) $additions .= avia_breadcrumbs(array(‘separator’ => ‘/’, ‘richsnippet’ => true));$html = str_replace(‘{class}’, $class, $html);
$html = str_replace(‘{title}’, $title, $html);
$html = str_replace(‘{additions}’, $additions, $html);
$html = str_replace(‘{heading}’, $heading, $html);echo $html;
if(!empty($avia_config[‘slide_output’]) && !avia_is_dynamic_template($id) && !avia_is_overview())
{
$avia_config[‘small_title’] = $title;
}
else
{
return $html;
}
}
}add_shortcode(‘bread_crumb’, ‘avia_title’);
————————————————————-
My settings in the backend and the result in the frontend are now like in these screenshots:(gallery with 3 pictures)
- This reply was modified 7 years, 6 months ago by brandhands.
May 11, 2017 at 5:58 pm #791793Hi,
Here is the css that will help you hide the unwanted breadcrumbs.
.stretch_full.container_wrap.alternate_color.light_bg_color.title_container { display: none; } .avia-builder-el-2 .stretch_full.container_wrap.alternate_color.light_bg_color.title_container { display: block; }
It’s really weird the function gets called so many times.
Alternatively, you can add a custom class in this function to the container// remove title add_filter(‘avf_title_args’, function($args) { $args[‘html’] = “<div class='{class} title_container show-breadcrumbs’><div class=’container’>{additions}</div></div>”; return $args; });
and use that class to show breadcrumbs.
Best regards,
VictoriaMay 12, 2017 at 10:22 am #792196Thank you, the css code did help. Now it works like wanted.
May 12, 2017 at 2:28 pm #792316Hi brandhands,
You might want to adjust it to work on other pages, if you need.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.