Jump to content
8ozStudios

Child Theme, How to Override Loop.php?

Recommended Posts

8ozStudios

Hi there, 

I'm new to PageLines, I just took over admin on a website that uses PageLines and already has a child theme running. I'm looking into how to customize the display of the archive page that lists posts of a specific category - I found the code that I want to manipulate in load.php in the parent theme but when I copy that file into the child theme (the way I would to override a page template in a parent theme), my changes aren't taking effect the way I expect. 

Is there another way to override this code?

In case it matters, I'm looking to override function 'loop()' in class 'PL_Framework_Content'. 

What am I missing here?

 

Share this post


Link to post
Share on other sites
Aires

Hi, have you tried to style the archive pages with the builder.


ndTgvai.jpg

Visit iheartpagelines.com for the latest tutorials on PageLines related products.

 

Share this post


Link to post
Share on other sites
8ozStudios

Thanks - what I want to achieve is more than a change in styles. I need to modify the code inside the loop in a specific way: I want to check for the value of a custom field associated with the post and, depending on the value, change the 'read more' link.

I'm comfortable with PHP and, in fact, I already wrote the new code but I don't know how to implement it in the child theme.

I've looked through the extensions and don't see one that would replicate the functionality I need - Loops, for example, doesn't give me enough flexibility. 

Any help is appreciated!

Share this post


Link to post
Share on other sites
chrisayers

So you want to make a new section?  Aries and I have gotten pretty good at this. Let's see if I can point you the right way.  This is the basic break-down of a standard PL plugin.  You create it all in a folder then install this to your WP site just like any WP plugin. 

TOP SECTION  

<?php
/*

  Plugin Name:   PageLines Section PopThumbs Plus
  Description:   Adds columnized thumbnails with H3 Title and captions that lightbox to full size images on click.

  Author:       PageLines
  Author URI:   http://pagelines.com
  Version:       5.0.9

  PageLines:     PL_PopThumbs_Plus

  Tags:         gallery, browser, animation, images, grid

  Category:     framework, free, sections, recommended

  Filter:       gallery

  Demo:         yes

*/

NAMING THE CLASS AND IMPORTING EXTERNAL JS

if ( !class_exists( 'PL_Section' ) )
    return;

class PL_PopThumbs_Plus extends PL_Section {

    function section_styles() {
        pl_script( 'prettyphoto', $this->base_url . '/prettyphoto.min.js' );
        pl_script( 'popthumbs', $this->base_url . '/pl.popthumbsplus.js' );
        pl_style( 'prettyphoto-css', $this->base_url . '/prettyPhoto/css/prettyPhoto.css' );

    }

CREATING THE ARRAYS AND THE SIDEBAR EDITOR
    function section_opts() {
        $options = array();

        $options[] = array(

            'title' => __( 'PopThumbs Plus Configuration', 'pl-section-popthumbs-plus' ),
            'type' => 'multi',
            'opts' => array(
                array(
                    'key' => 'popthumb_cols',
                    'type' => 'count_select',
                    'count_start' => 2,
                    'count_number' => 6,
                    'default' => '4',
                    'label' => __( 'Number of Columns for Each Thumb (12 Col Grid)', 'pl-section-popthumbs-plus' ),
                    'priv' => 'pro',
                ),
                array(
                    'key' => 'graphic_mode',
                    'type' => 'select',
                    'label' => __( 'Graphic Mode', 'pl-section-popthumbs-plus' ),
                    'default' => 'none',
                    'priv' => 'pro',
                    'opts' => array(
                        'none' => array( 'name' => __( 'None', 'pl-section-popthumbs-plus' ) ),
                        'border' => array( 'name' => __( 'Border', 'pl-section-popthumbs-plus' ) ),
                        'plus' => array( 'name' => __( 'Plus', 'pl-section-popthumbs-plus' ) ),
                        'shadow' => array( 'name' => __( 'Shadow', 'pl-section-popthumbs-plus' ) ),
                        'zoom' => array( 'name' => __( 'Zoom', 'pl-section-popthumbs-plus' ) ),
                    )
                ),
            )

        );


        $options[] = array(
            'key' => 'popthumb_array',
            'type' => 'accordion',
            'title' => __( 'PopThumbsPlus Items', 'pl-section-popthumbs-plus' ),
            'opts' => array(

                array(
                    'key' => 'title',
                    'label' => __( 'Image Title', 'pl-section-popthumbs-plus' ),
                    'type' => 'text',
                    'default' => 'Image Title',
                    'priv' => 'pro',
                ),
                pl_std_opt( 'background_color', array(
                    'key' => 'title_background',
                    'default' => '',
                    'label' => 'Title Background Color',

                ) ),
                pl_std_opt( 'scheme', array(
                    'key' => 'title_scheme',
                    'default' => 'pl-scheme-default',
                    'label' => __( 'Title Color Scheme', 'pl-section-popthumbs-plus' ),

                ) ),
                array(
                    'key' => 'thumb',
                    'label' => __( 'Thumb/Image', 'pl-section-popthumbs-plus' ),
                    'type' => 'image_upload',
                    'size' => 'big-thumb',
                    'default' => pl_fallback_image()

                ),
                array(
                    'key' => 'text',
                    'label' => __( 'Image Caption', 'pl-section-popthumbs-plus' ),
                    'type' => 'richtext',
                    'default' => 'Image Caption',
                    'priv' => 'pro',
                ),
                array(
                    'key' => 'link',
                    'label' => __( 'Link', 'pl-section-popthumbs-plus' ),
                    'type' => 'text',
                    'help' => 'Link Opens In A New Tab. Leave This Blank If Lightbox Is Desired.',
                    'priv' => 'pro',
                ),
                pl_std_opt( 'background_color', array(
                    'key' => 'caption_background',
                    'default' => '#ccc',
                    'label' => 'Caption Background Color',
                    'priv' => 'pro',

                ) ),
                pl_std_opt( 'scheme', array(
                    'key' => 'caption_scheme',
                    'default' => 'pl-scheme-default',
                    'label' => __( 'Caption Color Scheme', 'pl-section-popthumbs-plus' ),
                    'priv' => 'pro',

                ) ),

            )
        );

        return $options;
    }

CREATING THE OUTPUT


    function section_template() {

        ?>

        <div class="popthumbs-wrap pl-row pl-trigger" data-bind="plforeach: popthumb_array, plclassname: [ graphic_mode() || 'plus' ]">

            <div class="pl-col-sm-%s fix" data-bind="if: thumb() != '', plclass: [{tag: $root.popthumb_cols(), partial: 'pl-col-sm-'}]">
                <div style="padding:15px; border-radius:5px;" data-bind="style: { 'background-color': title_background }, plclassname: [title_scheme() ]">
                    <div class="popthumb-text" data-bind="visible: text() || title()">
                        <h3 class="pl-text-wrap" data-bind="text: title"></h3>
                    </div>

                </div>

                <a class="popthumb iframe-ignore-link" href="#" data-bind="plhref: link() || thumb(), plattr: {'rel': ( link() == '' ) ? 'prettyPhoto[]' : ''}">

        <span class="popthumb-thumb ">
          <img src="" data-bind="plimg: thumb" />
        </span>
        <span class="expander"><i class="pl-icon pl-icon-plus"></i></span>
      </a>
            
                <div style="  padding:15px; border-radius:5px;" data-bind="style: { 'background-color': caption_background }, plclassname: [caption_scheme() ]">


                    <div class="pl-text-wrap popthumb-desc" data-bind="pltext: text"></div>

                </div>

            </div>

        </div>

        <?php
    }


}
 

scr2.jpeg

scr1.jpeg

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×