-
AuthorPosts
-
July 6, 2016 at 10:22 pm #657742
I want to insert a “back” icon in the single post view. I have to insert the following code in single.php before the loop. But it does’nt work. In the article itself works the Code, if I write it in the code area.
But I want to display the icon automatically in any post What can I do?
Here a part of the code:... <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'> <div class='container template-blog template-single-blog '> <main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>> <div> <a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true" class="icon-reply" title="zurück"> <span class="avia_button_icon" data-av_iconfont="entypo-fontello" data-av_icon="?" aria-hidden="true"></span> </a> </div> <?php /* Run the loop to output the posts. * If you want to overload this in a child theme then include a file * called loop-index.php and that will be used instead. * */ get_template_part( 'includes/loop', 'index' ); ...
July 7, 2016 at 12:58 pm #657975Hey MargitW,
Could you link to an example post so that we can have a closer look please?
Best regards,
RikardJuly 7, 2016 at 2:15 pm #658056At the moment this situation:
Included in the single.php is the code. In addition, I have included a Code Block with this code below the sample post.
The code from the single.php should insert above the article a Reply icon, what does not work. The block of code in the sample post works. But now the title of the post has disappeared. Even if I remove the code block again, the title will no longer appear. What is this effect???July 11, 2016 at 3:01 am #659045Hi,
If you use the advance layout builder to build the content of the post, it’s not going to use the single.php file. You have to add the script in the template-builder.php file.
Best regards,
IsmaelJuly 11, 2016 at 6:13 pm #659459This is a good hint. But where must’ll insert this code for the back button?
?><div> <a href='javascript:history.go(-1)' onMouseOver='self.status=document.referrer;return true' class='icon-reply' title='zurück'> <span class='avia_button_ico' data-av_iconfont='entypo-fontello' data-av_icon='ue830' aria-hidden='true'></span> </a> </div> <?php
I have tried several places, nothing works.
This is the Code of template-builder.php:<?php if ( !defined('ABSPATH') ){ die(); } global $avia_config, $post; if ( post_password_required() ) { get_template_part( 'page' ); exit(); } /* * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory. */ get_header(); // set up post data setup_postdata( $post ); //check if we want to display breadcumb and title if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title(); do_action( 'ava_after_main_title' ); //filter the content for content builder elements $content = apply_filters('avia_builder_precompile', get_post_meta(get_the_ID(), '_aviaLayoutBuilderCleanData', true)); //if user views a preview me must use the content because WordPress doesn't update the post meta field if(is_preview()) { $content = apply_filters('avia_builder_precompile', get_the_content()); } //check first builder element. if its a section or a fullwidth slider we dont need to create the default openeing divs here $first_el = isset(ShortcodeHelper::$tree[0]) ? ShortcodeHelper::$tree[0] : false; $last_el = !empty(ShortcodeHelper::$tree) ? end(ShortcodeHelper::$tree) : false; if(!$first_el || !in_array($first_el['tag'], AviaBuilder::$full_el ) ) { echo avia_new_section(array('close'=>false,'main_container'=>true, 'class'=>'main_color container_wrap_first')); } $content = apply_filters('the_content', $content); $content = apply_filters('avf_template_builder_content', $content); echo $content; $avia_wp_link_pages_args = apply_filters('avf_wp_link_pages_args', array( 'before' =>'<nav class="pagination_split_post">'.__('Pages:','avia_framework'), 'after' =>'</nav>', 'pagelink' => '<span>%</span>', 'separator' => ' ', )); wp_link_pages($avia_wp_link_pages_args); //only close divs if the user didnt add fullwidth slider elements at the end. also skip sidebar if the last element is a slider if(!$last_el || !in_array($last_el['tag'], AviaBuilder::$full_el_no_section ) ) { $cm = avia_section_close_markup(); echo "</div>"; echo "</div>$cm <!-- section close by builder template -->"; //get the sidebar if (is_singular('post')) { $avia_config['currently_viewing'] = 'blog'; }else{ $avia_config['currently_viewing'] = 'page'; } get_sidebar(); } else { echo "<div><div>"; } echo avia_sc_section::$close_overlay; echo ' </div><!--end builder template-->'; echo '</div><!-- close default .container_wrap element -->'; get_footer();
July 11, 2016 at 6:48 pm #659475Hi!
No need for any php. Just add a content block and paste the following inside
<a href='javascript:history.go(-1)' onMouseOver='self.status=document.referrer;return true' class='icon-reply' title='zurück'> <span class='avia_button_ico' data-av_iconfont='entypo-fontello' data-av_icon='ue830' aria-hidden='true'></span>
it will show the informatious properly for you.
Let us know if that works out
Best regards,
BasilisJuly 11, 2016 at 9:05 pm #659544Where should I insert the code block? Below the article I tested this code. He destroyed the post. The title disappears. Please visit the link. In the future, there are several editors. These editors are not to insert a block of code. I want to display the icon automatically over any post over the post title.
July 14, 2016 at 5:02 am #660652Hi,
Sorry for the confusion. Please use the previous code then place it below or above this line:
echo $content;
Or use the “avf_template_builder_content” filter. Example: https://kriesi.at/support/topic/show-share-icons-on-portfolio-items-placement-issue/#post-586829
Best regards,
IsmaelJuly 16, 2016 at 10:25 pm #661683I have now inserted the code in the single.php. It works, but it does’nt appear the icon but the numbers “ue830”. What code should I add to make the icon appear? Now, in the code: data-av_icon = ‘ue830’. See the link please – you can see this over the title.
July 21, 2016 at 3:42 am #663166Hi,
Use this html code instead:
<a href="javascript:history.go(-1)" onmouseover="self.status=document.referrer;return true" class="icon-reply" title="zur�ck"> <span class="avia_button_icon" data-av_iconfont="entypo-fontello" data-av_icon="" aria-hidden="true"></span> </a>
Best regards,
IsmaelJuly 21, 2016 at 11:20 am #663287Thank you, Ismael. That was the solution. I’ve already tried this before, but Notepad ++ always made the symbol to a question mark. Now I have tried in the editor explicitly set the encoding of the file to utf8. And now the icon is maintained. I am very happy!
July 21, 2016 at 8:42 pm #663586 -
AuthorPosts
- The topic ‘Back-Icon in single.php’ is closed to new replies.