Jump to content


Photo
- - - - -

Showing Custom Field Data Within A Post And Category List


  • Please log in to reply
23 replies to this topic

#1 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 05 December 2012 - 06:19 AM

I'm trying to find the the best method within the Pagelines environment for extracting info from custom fields to show that info within the post loop of a custom post type. Am using a child theme. Been looking at the docs but no luck so far.

 

In my initial trial site I customised the TwentyEleven theme with WordPress code

Please Login or Register to see this Hidden Content

 

 

See the result here:

Please Login or Register to see this Hidden Content

 

I tried creating my own Section but it's outside the WP loop so won't pick up the data.

 

Overall, being new to PL I want to know what's the best way to get into the normal WP post loop for such customisations..

 

Thanks in advance.

Andris



#2 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 05 December 2012 - 06:26 AM

I thought maybe the 'postloop' section would give me clues where I could customise, but I don't understand where the loop is that this function calls in Sections > Postloop > section.php:

Please Login or Register to see this Hidden Content

 

Or am I just going about this entirely the wrong way around? :)



#3 Danny

Danny

    Is Awesome!

  • Moderators
  • 13008 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 05 December 2012 - 08:05 AM

Hi,

 

Does this help you ?


Please Login or Register to see this Hidden Content



#4 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 05 December 2012 - 02:47 PM

You need to use a wordpress action to put your code snippet exactly where its needed.

 

Install the free Actions plugin from the store, this highlights all the action areas.

 

Google add_action() for the wordpress docs.



#5 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 05 December 2012 - 10:57 PM

Hi Danny,

 

Thanks for the link but I've setup my custom post type and custom fields already. And I know how to show custom field data in a post.

 

I suppose, put simply, what I'm trying to understand is how to create my own customised post loop that applies only to my custom post type 'pram-walks'. Just how to do that within Pagelines is my stumbling block.



#6 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 05 December 2012 - 10:59 PM

... and I apologise in advance is it's already documented somewhere. If it is please point me in the right direction. Maybe a topic for the Developer documentation which is currently getting written?



#7 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 05 December 2012 - 11:00 PM

Ok, thanks Simon. I'll check it out.



#8 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 December 2012 - 01:51 AM

OK, I'll simplify my question right down to: How do I customise or create my own post loop in Pagelines?



#9 James B

James B

    Advocate

  • Moderators
  • 4979 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 07 December 2012 - 02:24 AM

Hi there, I'm not a developer so I'm not sure what to advise you on the code side of things, but would the Anyloop plugin help at all?

 

Please Login or Register to see this Hidden Content



#10 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 December 2012 - 03:40 AM

Hi James B. Thanks for the link - I really appreciate it - but it still doesn't address my needs; to have control of the display of a post loop.

 

Pagelines is a great tool for me, as I'm sole trader in a remote area and PL allows me to develop quickly and I have grasped the basic WP php code to alter sites pretty much any way I like.

 

I'm a newbie developer (great with CSS, HTML and muddle my way through PHP) but I seem to be in between skill sets when it comes to PL. I hoped signing up as a developer would give me access to more tools, learning or support. The Pagelines Chat and responses like 'try this plugin' seems to be for total newbies. I require documentation for a 'way in' to understand the PHP. I feel I'm just missing a simple PHP way of using actions and the PL hooks that I haven't grasped yet and which I'm hoping to get help for in this forum.  

 

But now it seems I'll need to give PL the flick as there isn't any help or documentation and the help simply isn't coming for, what I think, is a fundamental requirement; to create my own post loop.

 

Isn't there anyone that can help me?



#11 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 07 December 2012 - 04:37 AM

Why do you want to create your own loop?
Wordpress has filters to change the loop and we provide 100's of action points in the framework.


#12 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 December 2012 - 04:55 AM

Hi Simon,

 

Ok then, could you please instruct me on how to add

Please Login or Register to see this Hidden Content

within the existing PL loop by whatever means is required by PL? Like I mentioned, I just need a 'way in' to grasp the concept and then I can take the code you show me (and  where to put it) and run with it.



#13 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 December 2012 - 04:56 AM

BTW, just now I was successful in creating a new Section with my own loop but for some reason it wouldn't extract the custom field data. Would still greatly appreciate an answer for my previous post. Thanks.



#14 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 07 December 2012 - 11:41 AM

where do you want it echoed?



#15 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 11 December 2012 - 01:00 AM

Why do you want to create your own loop?
Wordpress has filters to change the loop and we provide 100's of action points in the framework.

 

 

Hi Simon, I appreciate your time on this. As I mentioned, if there was documentation on this I'd be all over it ;)

 

As per the trial site (

Please Login or Register to see this Hidden Content

) I want it echoed on a

Please Login or Register to see this Hidden Content

and

Please Login or Register to see this Hidden Content

(let me know if this is not what you meant). 

 

So, as per your suggestion please let me know how to use the PL 'action points' instead. Below is a simple example using my own section (for example sake). 

 
PS The editor put all those divs in!!

Edited by Simon_P, 11 December 2012 - 01:50 AM.
code removed, it broke the forums!!


#16 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 11 December 2012 - 01:56 AM

um, yea. You dont need to open and close php on every line ;)

 

If you want to paste code blocks use

Please Login or Register to see this Hidden Content

 

Is this walk thing a custom post type?

 

if so you could do this in child theme functions.php:

 

 

 

Please Login or Register to see this Hidden Content

assuming 'walk' is the post type for this example.


Edited by Simon_P, 11 December 2012 - 01:56 AM.
forgot global


#17 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 February 2013 - 04:57 AM

Hi Simon,

 

Sorry for my very late reply - been away from work with Pheumonia! 

 

Thanks for this except I get:

 

Parse error: syntax error, unexpected '{' in /Users/user/.../themes/pramwalks/functions.php on line:

 

 

Please Login or Register to see this Hidden Content

 

I can't see any error in the syntax and I'm positive the post type name and setup is correct too. Do you have any idea what that could be?



#18 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 07 February 2013 - 05:12 AM

Hi,

 

Please Login or Register to see this Hidden Content

is a plugin to which you place a PHP code as you demonstrated earlier.  Setting it up correctly, you'll get a shortcode which may be placed in a page.  Whatever the PHP code snippet is supposed to do, the shortcode will do in its place without modifying core files or making major coding changes.  It's relatively easy, and best, it's fast and free.



#19 anjuks

anjuks

    Member

  • Members
  • 18 posts

Posted 07 February 2013 - 06:31 AM

Hi Rob,

 

Thanks for your quick response, but adding a shortcode to every post to show core functionality! Are you kidding?

 

I'll learn more about hooks within Pagelines and figure out myself how to programmatically do it. But until then I think it's back to creating my own theme without Pagelines for this project!

 

Cheers.



#20 Danny

Danny

    Is Awesome!

  • Moderators
  • 13008 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 07 February 2013 - 01:24 PM

Hi,

 

Try this instead and change the post type name and custom field name according to your setup.

 

Please Login or Register to see this Hidden Content