Jump to content

Archived

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

robertgourley

Calling WP Loop elements in a section

Recommended Posts

robertgourley

Maybe I'm going about this the wrong way.  I was hoping to create a template, then call the posts/page feature image as a hook/shortcode to display that above the rest of the page loop.

What I'm specifically trying to do is have a full-width featured image, then a container with the post loop and side bar below. But I want the full-width image to be dynamically pulled from whatever post/page is using the template.

Share this post


Link to post
Share on other sites
Simon

Two ways of doing this.

  1. Create a shortcode that displays the featured image... the add the shortcode into the page with a section.
     
  2. Use an actual template file, they can call sections with a function see: https://github.com/PageLines-Team/pl-framework-pagelines/blob/master/tpl-home.php for an example.
    Actually your shortcode could also do something similar to this.. 

     

Share this post


Link to post
Share on other sites
robertgourley
12 hours ago, Simon said:

Two ways of doing this.

  1. Create a shortcode that displays the featured image... the add the shortcode into the page with a section.'

 Just to be clear, you're talking about PL shortcodes, not core WP? I couldn't find much documentation about shortcodes here, can you point me in the right direction. 

Is there any plans to make this an extension? I really just need a way to theme a page with a large image header and ideally text over in CSS. Sort of like this:

Screen Shot 2016-03-31 at 9.59.05 PM.png

 

Share this post


Link to post
Share on other sites
Simon

You could use the loops plugin that provides some handy shortcodes

in the post above I mentioned creating your own shortcode

Share this post


Link to post
Share on other sites
robertgourley

Thanks, I don't think loops will work since I need this on a per-page and per-post basis. I don't want the pagination, etc

I created a WP shortcode and it worked in loop, but not in the PL editor sections, so again I'm not sure if you are talking about creating a PL shortcode (which I can't find any documentation on the site).

Share this post


Link to post
Share on other sites
Aires

Hi @robertgourley,

Maybe you dont fully understand what Simon was suggesting. Loops comes with a tons of shortcodes that you can use without even having loops on the page. For instance using this shortcode  [loops_media size="thumbnail" align="left"] will give a featured image. You can use that along side some html and build any layout you like.

Check out these articles for a better understanding.

https://iheartpagelines.com/news/spectacular-posts-in-platform-5/ 

https://iheartpagelines.com/loops-learning-the-basics/

Post back if you have any other questions I might be able to guide you through it.

~Aires

 


ndTgvai.jpg

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

 

Share this post


Link to post
Share on other sites
robertgourley

@Aires thanks- I think this is what i was looking for. I couldn't find any loops shortcodes in the documentation here. I'll try it...

 

Share this post


Link to post
Share on other sites

  • Similar Content

    • Timothy
      By Timothy+
      Question! Does anyone know how to display a full post rather than the excerpt on the posts page? Normally I can replace 'the_excerpt' with 'the_content' on the page template, but i'm not finding that in the Framework templates...
      Thoughts?
    • micstepl
      By micstepl+
      When inserting a LOOP-Section within a WORDPRESS-Section (Pagelines Framework Content) >>> Images (loops_media) do not show. 
      (same section outside, works well)
    • micstepl
      By micstepl+
      how to make (easy) a post Navigation: previous / next
    • eusebius
      By eusebius+
      Hello,
      I recently added a function that allowed me to use the same tag taxonomy for both posts and pages. Thank God, it is working well.
      Now, I want to modify the standard post loop in the WP Loop section to show both of those post types whenever I navigate to the archive of one of those tags. After researching a bit, I found what I believe is the right code from the Codex and have tried to include it in section.php of my overridden section, but it doesn't seem to work. Here is what I have beginning from about Line 156:
      /* * Standard loop. */ // The Query function standard_loop() { $args = array('post_type' => array( 'post', 'page' )); $query = new WP_Query( $args ); if( $query->have_posts() ) while ( $query->have_posts() ) : the_post(); the_content(); endwhile; } function loop(){ $count = 0; global $plpg; if( have_posts() ) while ( have_posts() ) : the_post(); $count++; $format = get_post_format(); What am I doing wrong?
      Thanks in advance.
    • DonRicardoRVM
      By DonRicardoRVM+
      HI!
       
      First of all, sorry for my bad english.
       
      I have a problem that I never could solve: I can´t translate the words "READ MORE" in the loop. Where must I translate them?
       
       
×