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*

Child theme

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #24634
    ptp
    Participant

    Hi,

    I want to change the code in the content-extensions.php file, so I’ve created a child theme and included the file structure (inc/structure) and file in my child theme.

    I’ve changed the code in the content-extensions.php file in the child theme but the code from the parent theme is still being executed. I tested the code change in the main theme (only a small change) and it worked fine.

    I want the archive page content to show the content and not the excerpt so I changed line 163 from <?php the_excerpt(); ?> to <?php the_content(); ?>

    Is there anyway to do this using hooks in the functions.php?

    Or can you tell me what I should be doing to make the code in the child theme over ride the code in the parent theme.

    Thanks
    Paul

    #24663

    Hi ptp,

    Create a functions.php file and first unhook the functions then only customize the code in your child theme.
    example for page 404 to unhook :-

    unhook functions
    
    // Unhook default Thematic functions
    function unhook_thematic_functions() {
        // Don't forget the position number if the original function has one
    
    remove_action( 'interface_404_content', 'interface_display_404_page_content', 10 );
    
    }
    add_action('init','unhook_thematic_functions'); // removes the header content by using hook interface_header
    
    add_action( 'interface_404_content', 'interface_child_display_404_page_content', 10 );
     
    function interface_child_display_404_page_content() {      ?>   
    <div id="content">
    		<header class="entry-header">
    			<h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'interface' ); ?></h1>
    		</header>
    		<div class="entry-content clearfix" >
    			<p>Thank you</p> 
    		</div><!-- .entry-content -->
    	</div><!-- #content -->
      <?php 
    }

    Hope this code may help you to customize the code and also view this codex
    http://codex.wordpress.org/Child_Themes

    Thank you!

    #24672
    ptp
    Participant

    Hi,

    I was hoping you could be more specific about this than just giving examples.

    It looks like I’m going to have to unhook the whole “interface_theloop” from “inteface_loop_content”, then duplicate it (giving it a different name) and duplicate all the functions it calls in the child theme functions.php before adding the new function back in as the called functions don’t seem unhookable. That seems a bit drastic.

    At the minimum I’m going to have to duplicate “interface_theloop_for_archive” and change one line, hopefully this will over ride the function in the parent theme.

    Seems a lot of work just to get the content displaying instead of the excerpt.

    Thanks
    Paul

    #24704

    Hi ptp,

    If you are unable to create a child theme then you may directly change in the core file. But each and everytime you update to the theme then you need to go to the same page and change the code. We can not provide you the full code. If you like to change then you need to hire a developer to fix it. because we have designed our theme this way.

    Thank you!

    #24720
    ptp
    Participant

    Hi,

    If you read what I said in my original post you’ll see that i do have a child theme but your theme doesn’t seem to support a child theme the way WordPress.org recommends. I should be able to copy the directory structure from the parent theme into the child theme then edit the file I want and it should over ride the same file in the parent theme. I can’t do this with your theme.

    I haven’t asked you to provide the full code but I can’t find any hook reference for the theme anywhere, so all I can do is pick through the theme code or ask. I thought asking would be quicker but actually I’ve fixed it by picking through the code.

    I’ve fixed the problem by copying the function that needs changing into the child theme’s functions.php and editing the bit I need changing. It over rides the function of the same name in the parent theme as you have coded the functions so this happens.

    So no hooks needed which is good as I couldn’t use a hook to do this without copying virtually the whole content-extensions.php file into the child theme functions.php due to the way it has been coded.

    I’m working on a customer’s site who has the pro theme installed, I’ve told them that support isn’t very good.
    Thanks
    Paul

    #24746

    Hi ptp,

    You don’t need to create a file structure (inc/structure), you can control all from your functions.php,

    Ok this is for archive.php file only to display the full content using child theme instead of using excerpt. You may do in the same way for other pages too.

    Add this follow code in your functions.php file

    // Unhook default Thematic functions
    function unhook_thematic_functions() {
    remove_action( 'interface_loop_content', 'interface_theloop', 10 );
    }
    add_action( 'interface_loop_content', 'interface_child_theloop', 10 );
    /**
     * Shows the loop content
     */
    function interface_child_theloop() {
    	if( is_page() ) {
    		if( is_page_template( 'page-templates/page-template-blog-image-large.php' ) ) {
    			
    			interface_theloop_for_template_blog_image_large();
    			
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-image-medium.php' ) ) {
    			interface_theloop_for_template_blog_image_medium();
    		}
    		elseif( is_page_template( 'page-templates/page-template-blog-full-content.php' ) ) {
    			
    			interface_theloop_for_template_blog_full_content();
    			
    		}
    		else {
    			interface_theloop_for_page();
    		}
    	}
    	elseif( is_single() ) {
    		interface_theloop_for_single();
    	}
    	elseif( is_search() ) {
    		interface_theloop_for_search();
    	}
    	else {
    		interface_theloop_child_for_archive();
    	}
    }
    
    if ( ! function_exists( 'interface_theloop_child_for_archive' ) ) :
    /**
     * Fuction to show the archive loop content.
     */
    function interface_theloop_child_for_archive() {
    	global $post;
    
    	if( have_posts() ) {
    		while( have_posts() ) {
    			the_post();
    
    			do_action( 'interface_before_post' );
    ?>
    
    <section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <?php do_action( 'interface_before_post_header' ); ?>
      <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_author() !=''){?>
          <div class="entry-meta"> <span class="cat-links">
            <?php the_category(', '); ?>
            </span><!-- .cat-links --> 
          </div>
          <?php } ?>
          <!-- .entry-meta -->
          <h1 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>">
            <?php the_title();?>
            </a> </h1>
          <!-- .entry-title -->
           <?php if (get_the_author() !=''){?>
          <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 -->
        <div class="entry-content clearfix">
          <?php the_content(); ?>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta clearfix"> <span class="tag-links">
          <?php $tag_list = get_the_tag_list( '', __( ' ', 'interface' ) );
    						if(!empty($tag_list)){
    					echo $tag_list;
    					
    						}?>
          </span><!-- .tag-links -->
        </footer>
        <!-- .entry-meta --> 
         <?php } else { ?>
       </header>
    		    <?php the_content();
          } ?>
      </article>
    </section>
    <!-- .post -->
    <?php
    			do_action( 'interface_after_post' );
    
    		}
    	}
    	else {
    		?>
    <h1 class="entry-title">
      <?php _e( 'No Posts Found.', 'interface' ); ?>
    </h1>
    <?php
       }
    }
    endif;

    Hope this may help you

    Thank you!

    #24747
    ptp
    Participant

    As I said, I’ve already fixed the issue without having to unhook the whole loop.

    #24790

    That’s great ptp

    Thank you!

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