Location Needed – Where To Call Funtion (Within Post)
-
I want to display something here:
[img]http://i.imgur.com/QKQKuRO.png?1[/img]
Right now it’s like this:
With this code in the single.php file:
In which file do I have to call the function to be displayed like in the first image? And preferably in which line (before/after a certain code) within that file?
I hope someone can help me.
Mod
I don’t know what code you are using to create that function (?), but you could add it to a Graphene action hook widget area.
Do you know which one it is? I believe it’s one of the following:
loop.php
loop-single.php
loop-page.php
I want it displayed below the meta data (category, edit post, posted by, etc.) and above the actual post and page content.
That’s the function by the way:
/* WPML Post Available With Flag & Text */
function icl_post_languages(){
$languages = icl_get_languages('skip_missing=1');
if(1 < count($languages)){
echo '<div id="icl_available_language"><ul>';
echo __('This post is also available in: ');
foreach($languages as $l){
echo '<li>';
if($l['country_flag_url']){
if(!$l['active']) echo '<a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" />';
if(!$l['active']) echo '</a>';
}
if(!$l['active']) echo '<a href="'.$l['url'].'">';
echo icl_disp_language($l['native_name']);
if(!$l['active']) echo '</a>';
echo join(', ', $langs);
echo '</li>';
}
echo '</ul></div>';
}
}I tried it with loop-single.php (graphene_before_post_content). When I add this code it looks like this:
http://i.imgur.com/S81YMPh.png
When I wrap it in
<?php *code* ?>
it looks like this:http://i.imgur.com/fK2GNnI.png
The function is usually called in single.php via
icl_post_languages();
. The WPML support told me to contact the theme author because they don’t know how I can add this feature between the meta data and the post content. :/I got closer to my goal by now. I looked at the widget code for the previous/next links (from your tutorial) and figured out what to do. Thanks for your tip with the action hook widget.
<div class="icl_available_language">
<?php icl_post_languages(); ?>
</div>Just added some CSS tweaks and I finally got it.
Site: https://www.anonyrev.com/uncategorized/sdrxfgvhjkloa/
Thanks again for your help. Finally another issue solved after days of struggling.
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.