This topic is now archived and is closed to further replies.

  • 0

Where is archive.php ? -> Continued


Posted · Report post

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 )

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


Please advice.


Share this post

Link to post
Share on other sites

3 answers to this question

Posted · Report post

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.

Share this post

Link to post
Share on other sites

Posted · Report post

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.

1 person likes this

Share this post

Link to post
Share on other sites

Posted · Report post

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]


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.


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