Support » Theme: Perfetta » Add code to index.php to be called before content of page

  • Resolved musikadventskalender

    (@musikadventskalender)



    Hi Perfetta-Team!

    We love your theme and are currently using it at our multi-lingual musical adventcalender at http://www.musikadventskalender.de

    We use WPML on our blog to manage the multiple language we have on our site.
    (On a side note: Supporting eastern european languages and they’re special letters would be awesome!)
    WPML can show a tag “This page is also available in …” for each single post (e.g. http://musikadventskalender.gfps.org/1-ili-ili). Unfortunately it is not able to suppport this regularly on the home/start-page or any category-page.
    So I asked WPML for help: https://wpml.org/forums/topic/show-this-post-is-also-available-in-on-starthome-correctly/
    The solution code they provided seems to do the right ting – BUT I can’t find the place where I should post the code so that it resolves my issue.
    I can get all of it work, but the text for the language selector is never posted before the regular content of the post, like it is for the single post.
    So my question is – where do I put the code to call for the language selector. I think its somewhere within the index.php, but where exactly would it be correct?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Hi there

    just a quick update – I was able to resolve this myself after a bit more trail-and-error…

    In case anyone wonders the key is to put the call for the function before “the_content” in the entry summary-section of the content.php

    In case anyone wonders, here is the content.php I’m now using…
    (I have another question, but I’ll add a separate topic)

    <?php
    /**
     * The default template for displaying content
     * Used for both single and index/archive/search.
     *
     */
    
    $reveal = get_theme_mod('perfetta_scroll_reveal', '0');
    $reveal_data = '';
    
    if($reveal == '1' && !is_singular()) {
    	$reveal_data = ' data-scroll-reveal="enter bottom"';
    } 
    
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php echo $reveal_data; ?>>
    	<?php get_template_part( 'content', 'meta' ); ?>
    	<div>
    		<?php get_template_part( 'content', 'header'); ?>
    
    		<?php if ( is_home() || is_search() || is_archive() || is_tag()) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php wpml_post_available_in('', get_the_ID() ); the_content(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    		<?php the_content(); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'perfetta' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    
    		<?php get_template_part( 'content', 'footer' ); ?>
    	</div>
    </article><!-- #post -->
Viewing 1 replies (of 1 total)
  • The topic ‘Add code to index.php to be called before content of page’ is closed to new replies.