Jump to content
linkinp

Where is archive.php ? -> Continued

Recommended Posts

linkinp    4
linkinp

Ok I understand now that when you create a custom post type, pagelines automatically creates a template for it, which can be further customized via drag and drop.

( Thanks Simon for answering that here http://www.pagelines.com/forum/topic/21820-where-is-archivephp/ )

This is pretty neat. B)

However, I now need to add some custom code to it. Meaning perform some initializations etc.

I am a beginner in wordpress and my assumption is that if this were usual word-press, I could have added this initialization code in single.php :ph34r:

Is there some place I can do this in pagelines?

-------------------

I want to write a select query before the_post()

populate some global variables

and in the actual custom post I want to use these variable values to generate post content dynamically.

but currently in single.php ,I simply see a statement

setup_pagelines_template();

Please advice.

----------------

Share this post


Link to post
Share on other sites
Rob    547
Rob

We should start with a basic premise that PageLines is a Framework and not a theme, thus it doesn't use the typical files common to themes such as archive.php and single.php.

That said, some code may be added to your site in various sections or in particular areas of the page using hooks or other means.

What's the code you're trying to add? Can you paste it here? Also, show us where the results are supposed to go with a mocked up screenshot. Thanks so much for your understanding and cooperation.

  • Like 1

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
linkinp    4
linkinp

I pondered on what you have suggested and it has clarified some more.

So Here is what I have done and it seems to be working fine.

I have added some php code (Select query) in my post.


[php] $entries = $wpdb->get_results($sql); [/php]


[/code]



I set some global variables from the query.

[code] global $field_val

and then access these variables in the Boxes below in the page.

This way I have dynamic text in a number of boxes below based on the post.

I can also re-arrange these boxes with drag and drop without fear of loosing the data.

SUPER NEAT :lol:

It appears to perform and do just what I wanted.

Please let me know if this method has any down-sides ?

Meaning when I take the site live, will a number of people accessing mix up the global variables ?

Share this post


Link to post
Share on other sites
Rob    547
Rob

While you have the site local, test it on all possible browsers. The only downside is going to be how browsers handle it. That's something we can't tell from here.


Former PageLines Moderator, Food Expert and Raconteur

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


  • Similar Content

    • art23130
      By art23130+
      I have uploaded a file shoing missing sections for Custom Post Type
      It is OK for categories and tags but not for a single post types. 
      This is the link. 
      https://www.geoinformation.com/geocode_library/10-10570-rsg-2016-003/
      Any idea?
      thanks 
      Binder1.pdf
    • PeriniNero
      By PeriniNero+
      We are building a Custom Post Type with Custom Fields and Custom Taxonomies.
      The only thing we dont understand is how to embed the Custom Fields including header tags and stuff in the Postloop (now we use a text-box below the postloop section but also SEO wise this is not best pratice).
      So we thought to copy the dms Postloop section to our child theme and rename this, to add an extra Postloop section to our theme. Is this the way?
      What exactly to adjust in those 3 files class.posts.php, section.php and style.less (at this point we know how to change the thumb LOL) and where to add the Custom Fields shortcodes?
      Thanks.
    • Audun MB
      By Audun MB+
      I'm using plugins such as Events Manager and WP Glossary. Basically I need to edit the meta information and the breadcrumb for the custom post types Event and Term. The plugins instruct me to add a single-event.php and single-glossary.php in my (child) theme.
      What should I use as a basis for these files? Can I use the templates in the Framework main theme as a basis (tpl-a.php)? Or should I use the whole page.php file?
       
    • ketri
      By ketri
      Hello,

      When I select a page template for a custom post type page, it also selects the same template for the children of this custom post type. 
      I want to have my custom post type template as a heavily customized loop that I've developed myself, and the children (they are articles) as a completely another template.
       
      Is there a function that would allow me to select different templates for them on DMS?

      Thank you very much in advance.
    • dawsonbarber
      By dawsonbarber+
      Hi Enrique
       
      I want to add a Starbar to a Custom Post Type.
       
      I've tried to simply copy/paste the full section code from the source code, but the animation doesn't happen.
       
      Any idea on what I'm missing/doing wrong?

      Cheers
       
      Dawson
×