Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1147294

    Hello!
    I have inserted an custom field in single-q_a.php for my custom post type q_a:

    //show custom field
    				the_field('svar_til_brukeren');
    
    	                        //show related posts based on tags if there are any
    	                        get_template_part( 'includes/related-posts');

    Now the social share section is displayed above this field, I would like them to be below the custom field.

    #1147540

    Hey guttogjente,

    Your code runs after /enfold/includes/loop-index.php and it should run inside. The share buttons function is called before the code that you added.

    Best regards,
    Victoria

    #1147700

    Thanks, Victoria!
    I copied loop-index.php and added my code after line 346 like this :

                echo $close_header;
    ?>
    				<h5>Gutt og Jente svarer:</h5>
    				<?php
    					
    			//show custom field
    				the_field('svar_til_brukeren');
    
                // echo the post content

    Then I renamed it loop-index-q_a.php (since this is only for that custom post type) and added it to the includes folder in my child theme, but could not see any change on my page, so I therefore removed it again so it should not cause any error. Should I also modify something simple-q_a.php in order for to be called instead of loop-index.php for this post type, like line 40:
    get_template_part( 'includes/loop', 'index' );

    #1148498

    Hi guttogjente,

    Yes, you need to call your custom file it the get_template_part.

    Best regards,
    Victoria

    #1148795

    Thanks, Victoria! I added loop-index-q_a.php as described above, read about the syntax for the get_template_part() function and changed the loop-index call in simple-q_a.php to:
    get_template_part( 'includes/loop', 'index', 'q_a' );
    But it still does not work after I cleared cache. Do you know why? If you have time, you can log in through the information I shared in the private content in the first post.

    #1150098

    Hi,

    Thank you for the update.

    Try to rename the file to loop-q_a.php, then change the value of the get_template_part function.

    get_template_part( 'includes/loop', 'q_a' );
    

    Let us know how it goes.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.