• Resolved fibroidcincinnati

    (@fibroidcincinnati)


    I am planning on making a few tweaks to the page templates. I plan on copying them over to my child theme first. I need to figure out which php file corresponds to the “default page template” in Sela. Anyone know the answer to that? I made a couple of static pages using the “default page template”. Just glancing at them it looks like it might be content.php, content-page.php, or page.php. Is one of those correct?

    And followup question, the first thing I am going to edit is to try and add the social share buttons to also be above the post either above or below the title. I was going to copy the correct php file to my child and try and add it using the method found here:

    https://jetpack.me/2013/06/10/moving-sharing-icons/

    Would that work? (so two parts / questions to this message)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    Clarification… I am first trying to do this and edit the static pages I made with the default template…

    Default page template for page file for any theme is page.php

    Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    Thank you.

    So I pulled the page.php fle. Here are it’s contents:

    <?php
    /**
     * The template for displaying all pages.
     *
     * @package Sela
     */
    
    get_header(); ?>
    
    		<?php while ( have_posts() ) : the_post(); ?>
    
    			<?php get_template_part( 'content', 'hero' ); ?>
    
    		<?php endwhile; ?>
    
    		<?php rewind_posts(); ?>
    
    		<div class="content-wrapper <?php echo sela_additional_class(); ?>">
    			<div id="primary" class="content-area">
    				<main id="main" class="site-main" role="main">
    
    					<?php while ( have_posts() ) : the_post(); ?>
    
    						<?php get_template_part( 'content', 'page' ); ?>
    
    						<?php
    							// If comments are open or we have at least one comment, load up the comment template
    							if ( comments_open() || '0' != get_comments_number() ) {
    								comments_template();
    							}
    						?>
    
    					<?php endwhile; // end of the loop. ?>
    
    				</main><!-- #main -->
    			</div><!-- #primary -->
    
    			<?php get_sidebar(); ?>
    		</div><!-- .content-wrapper -->
    
    <?php get_footer(); ?>

    If I want to add sharing icons beneath the title and above the body of the page, how would I do that? / Where would I add those? Am I in the wrong file?

    Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    I placed the code as you can see here in page.php:

    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php
    	if ( function_exists( 'sharing_display' ) ) {
        		sharing_display( '', true );
    	}
    
    	if ( class_exists( 'Jetpack_Likes' ) ) {
    		$custom_likes = new Jetpack_Likes;
    		echo $custom_likes->post_likes( '' );
    	}
    ?>
    
    <?php get_template_part( 'content', 'page' ); ?>

    This places the social sharing just above the post title (as expected).

    Any idea how to change the actual post? To move them below the post title?

    Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    Follow up question on this… it seems that all the social sharing throughout the site is disabled now unless I manually add them with the above code? The social sharing option appears when editing posts and i check the box… however, checking it does nothing on the blog post page. so now i have to go to each template and add them back by hand?

    Another example is the page.php template above… when I added the icons above the title it removed them from below the post. So I had to put the code in both places to get them above and below.

    So two questions now, 1. how can I get the social sharing below page / post titles?… and 2. Is there a way to modify the above code so it is not removing all the wordpress added social sharing areas?

    Here is what I added to my functions.php if you need to see that:

    /**
     * Adds functions for manually placing social sharing and likes
     *
     */
    function jptweak_remove_share() {
        remove_filter( 'the_content', 'sharing_display',19 );
        remove_filter( 'the_excerpt', 'sharing_display',19 );
        if ( class_exists( 'Jetpack_Likes' ) ) {
            remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
        }
    }
    
    add_action( 'loop_start', 'jptweak_remove_share' );
    ?>
    Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    Okay so I answered the second question myself… i simply remove the function jptweak_remove_share portion of the functions.php and left the add_action part and that fixed the problem with the social sharing areas being removed. so now I am just adding them in addition to where wordpress adds them based on the checkboxes.

    But question 1 still remained… how can i move them to below titles in pages/posts? are there other php files I should be looking into editing?

    Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    figured it out.

    content.php and content-page.php were where i needed to add these areas below the titles.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Which php is default page template?’ is closed to new replies.