Forum

Thread tagged as: Question, Configuration, Blog

blog feed option

Hello

On my site I have a sidebar where I want to display various content, i.e. Twitter Feed, News and show latest blog.

On the perch side I have created a template with check boxes so client can select what features to include in the sidebar.

This works great but how would I call the option to display blog on this template? I thought if I added a checkbox and put the blog call and with perch if it would work but does not, any ideas?

My latest (sidebar) template

<div class="headlineq"><h2 class="larger"><perch:content type="text" id="latest" label="Latest Column Title" title="true" /></h2></div>
<perch:content type="checkbox" id="twitter" value="1" label="Add Twitter Feed" suppress="true" />
<perch:if exists="twitter">
        <br />
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/EpicWeekends" data-widget-id="697732528988413953" data-height="380" data-width="100%">Tweet us at Epic Weekends</a></div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^https:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</perch:if>

<perch:content type="checkbox" id="facebook" value="1" label="Add facebook Ad" suppress="true" />
<perch:if exists="facebook">
       <div class="fb-page" style="margin:15px 0px 0px 15px; padding:0px; border:1px #333 solid; border-radius:5px;" data-href="https://www.facebook.com/courtneywebdesign" data-width="365" 
  data-hide-cover="false"
  data-show-facepile="false" 
  data-show-posts="false"></div>
</perch:if>
<perch:content type="checkbox" id="blogfeed" value="1" label="Add Blog Feed"/>

then on my page I have

 <div class="col-md-4 md-margin-bottom-20">
                <?php perch_content('Latest Column'); ?>
              <perch:if exists="blogfeed">  <?php
perch_blog_custom(array(
  'sort'=>'postDateTime',
  'sort-order'=>'DESC',
  'template'=>'blog/homepage_post_in_list.html',
  'count'=>1
)); ?></perch:if>
  </div> 

thank you

Denise

Denise Courtney

Denise Courtney 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

On your page you're mixing in template code, which will never work.