badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

How can I set/make content-extension.php in the Child-Theme?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #80642
    pentalogia
    Participant

    Hello.
    I’m going to insert some code line in Single.php.
    I know content-extension.php is running as a Single.php in this Theme.
    This file is in structure <- inc folder.
    I want to use/modify through an Alias file in Child directory.
    How can I make a content-extension.php in the Child-Theme?
    Can I make ‘(interface-child)-> inc -> structure-> content-extension.php’?
    I’m doing it. But I can’t run my procedure through modifying a content-extension.php in Child directory.
    How can I set/write any code line in Function.php of Child-folder?
    Of course, I read ‘https://developer.wordpress.org/themes/advanced-topics/child-themes/&#8217;. But I can’t it.
    I want to know directly here the code/ way for using content-extension.php in Child-Theme.
    All the codes in my Function.php:

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
    }
    ?>
    #80733
    pentalogia
    Participant

    too difficult.
    Actually, I want to change/add a line in content-extension.php.
    <br><span id='view_count' class="highlight">&nbsp;<?php echo do_shortcode( '[jp_post_view]' ); ?> &nbsp;</span>test<br>

    But If I use an Unhook-Function in Fucntion.php, All the original function lines will be changed?
    I need to insert only that line into 299 line.
    299 line is included the function ‘interface_theloop_for_single’.
    When I applied the following code in Function.php it didn’t work and crushed.

    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    remove_action( 'interface_theloop_for_single');
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook interface_header
    add_action( 'interface_theloop_for_single', 'interface_child_theloop_for_single');
    
    function interface_child_theloop_for_single() {
    	global $post;	
    	global $options, $array_of_default_settings;
     $options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults());
    
    	if( have_posts() ) {
    		while( have_posts() ) {
    			the_post();
    
    			do_action( 'interface_before_post' );
    ?>
    <section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <article>
        <?php
    				if( has_post_thumbnail() ) {
    					$image = '';        			
    		     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    		     		$image .= '<figure class="post-featured-image">';
    		  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
    		  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    					$image .='<span class="arrow"></span>';
    		  			$image .= '</figure>';
    
    		  			echo $image;
    		  		}
    	  			?>
        <header class="entry-header">
        	<?php if(get_the_time( get_option( 'date_format' ) )) { ?>
    		<!-- .post view count -->
    		<br><span id='view_count' class="highlight">&nbsp;<?php echo do_shortcode( '[jp_post_view]' ); ?> &nbsp;</span>test-line<br>
    		<!-- .post view count end -->
          <div class="entry-meta"> <span class="cat-links">
            <?php the_category(', '); ?>
            </span><!-- .cat-links --> 
          </div>
          <!-- .entry-meta -->
          <h2 class="entry-title">
            <?php the_title();?>
          </h2>
          <!-- .entry-title -->
          <div class="entry-meta clearfix">
            <div class="by-author vcard author"><span class="fn"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"  title="<?php  esc_attr(the_author()); ?>">
              <?php the_author(); ?>
              </a></span></div>
            <div class="date updated"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_time() ); ?>">
              <?php the_time( get_option( 'date_format' ) ); ?>
              </a></div>
            <?php if ( comments_open() ) { ?>
            <div class="comments">
              <?php comments_popup_link( __( 'No Comments', 'interface' ), __( '1 Comment', 'interface' ), __( '% Comments', 'interface' ), '', __( 'Comments Off', 'interface' ) ); ?>
            </div>
            <?php } ?>
          </div>
          <!-- .entry-meta --> 
        </header>
        <!-- .entry-header -->
        	<?php } ?>
        <div class="entry-content clearfix">
          <?php the_content();
        		
                   wp_link_pages( array( 
    						'before'            => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'interface' ),
    						'after'             => '</div>',
    						'link_before'       => '<span>',
    						'link_after'        => '</span>',
    						'pagelink'          => '%',
    						'echo'              => 1 
                   ) );
                   ?>
        </div>
        <?php if(get_the_time( get_option( 'date_format' ) )) { ?>
      </header>
      <?php } ?>
        <!-- entry content clearfix -->
        
        <?php if( is_single() ) {
    					    $tag_list = get_the_tag_list( '', __( ' ', 'interface' ) );
    
    						if( !empty( $tag_list ) ) { ?>
        <footer class="entry-meta clearfix"> <span class="tag-links">
          <?php
    								echo $tag_list;?>
          </span><!-- .tag-links --> 
        </footer>
        <!-- .entry-meta -->
        <?php  }
        do_action( 'interface_after_post_content' );
    
              }
    
        do_action( 'interface_before_comments_template' ); 
    
        comments_template();
    
        do_action ( 'interface_after_comments_template' );
    
        ?>
      </article>
    </section>
    <!-- .post -->
    <?php
    			do_action( 'interface_after_post' );
    
    		}
    	}
    	else {
    		?>
    <h2 class="entry-title">
      <?php _e( 'No Posts Found.', 'interface' ); ?>
    </h2>
    <?php
       }
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.