1 (edited by wesy2kn1 2014-11-05 23:12:54)

Topic: Couple of questions

I am having an issue with the creating a blog page template where it shows the latest posts. Here is what I have so far.

 
<?php Chunk::get('header'); ?>
<body id="page-top">
    <!-- Navigation -->
    <nav class="borderbottom">
        <?php Chunk::get('nav'); ?>
    </nav>
        <div class="coverphoto"></div>
        <section id="content" class="bordertop borderbottom">
            <div class="container text-center">
               <?php Action::run('theme_pre_content'); ?>
                <div class="row">
                <h2 class="PageTitle"><?php echo Page::title(); ?></h2>
                    <div class="col-lg-12">
                        <div id="PageContent">
                         <?php Action::run('theme_pre_content'); ?>
                                <?php echo Blog::getPosts(10); ?>
                                <div class="col-xs-4 tags">
                                <h3>Tags</h3>
                                <?php echo Blog::getTags(); ?>
                            </div>
                        </div>
                            <?php Action::run('theme_post_content'); ?>
                        </div>
                    </div>
                </div>
            </div>    
        </section>
        <aside class="cta-quote" style="background-image: url('/public/assets/img/bg-aside.jpg');">
            <?php Chunk::get('aside_quote'); ?>
        </aside>
        <section id="tools" class="bg-gray borderbottom">
            <?php Chunk::get('section_ad'); ?>
        </section>
        <!-- Footer -->
    <footer class="footer" style="background-image: url('/public/assets/img/bg-footer.jpg');">
        <?php Chunk::get('footer'); ?> 
    </footer>
    <!-- Plugins -->
            <?php Chunk::get('plugins'); ?> 
    </body>
</html> 

I would like to know how I go about making the posts show as the 10 latest entries in excerpt with a read more link and then have an archive page. Is that achievable?

Also I haven't seen how Monstra handles RSS. Please let me know how I code that in if possible too. Thanks in advance everyone.

Re: Couple of questions

Update:

From my combing the forums deeper I've managed to find this post from nakome describing how to change the blog view to show only the post title date and tags.

http://forum.monstra.org/post/1581/#p1581

Code is shown here

<?php foreach($posts as $post) { ?>
    <h3><a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug'] ?>"><?php echo $post['title']; ?></a></h3>
    <div class="entry-meta monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></div>
<?php } ?>

This almost accomplishes what I'm trying to do. The other thing that is neccesary for the design is to actually show a summary just below the bost title example:

<?php foreach($posts as $post) { ?>
    <h3><a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug'] ?>"><?php echo $post['title']; ?></a></h3>
    <div class="entry-meta monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></div>
<div class="post teaser"><!--first paragraph of post and clickthrough link-->
<span class="post_link">
<a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug'] ?>">Read More</a>
</span>
</div>
<?php } ?>

I'm trying to figure out how to show the first paragraph of the post and not the other portions. Please advise on how to go about that. Is there a plugin that achieves this if it is not built into the monstra blog core?

Re: Couple of questions

So u want to show just only title of post? Use post "title" only than, remove tags code and content code if i got u correctly

(с) Roman Art
So far So good wink

RomanArt's Website

Re: Couple of questions

RomanArt wrote:

So u want to show just only title of post? Use post "title" only than, remove tags code and content code if i got u correctly

Actually RomanArt, I found an example of just what I want. It's shown in MonstraPro theme you have here - http://001.demo-mp.monstrapro.com/news

It looks just like this-

Re: Couple of questions

I have managed to get the blog template to where it shows everything BUT the first paragraph like I'd like to see. You can see an example here - http://thoriumwealth.com/blog Does anyone have an idea how I go about capturing the first paragraph of each post and displaying it as seen in the screen capture I've given above? Thanks!

Re: Couple of questions

wesy2kn1 wrote:
RomanArt wrote:

So u want to show just only title of post? Use post "title" only than, remove tags code and content code if i got u correctly

Actually RomanArt, I found an example of just what I want. It's shown in MonstraPro theme you have here - http://001.demo-mp.monstrapro.com/news

It looks just like this-

That is news plugin from KaNekt , its not a blog i made monstrathemes.com from blog plugin, but than i find out that "news" is better

(с) Roman Art
So far So good wink

RomanArt's Website

Re: Couple of questions

Ah interesting. Thanks! Is this available for 3.0.1?

Re: Couple of questions

Yes but it has license for comercial use

(с) Roman Art
So far So good wink

RomanArt's Website

Re: Couple of questions

Thank you very much for your help thus far Roman. Now if anyone knows how to display articles by date please let me know. Many thanks!

Example -

<h3>October</h3>
<ul>
  <li>Article from 15th</li>
  <li>Article from 21st</li>
  <li>Article from 31st</li>
</ul>

Re: Couple of questions

Continuing on my issues with the blog. I wanted to let everyone know if they were having issues with pagination just make changes to the following file-

pager.view.php

<br>
<br>
<?php
    if (Request::get('tag')) $tag = '&tag='.Request::get('tag'); else $tag = '';
    $neighbours = 6;
    $left_neighbour = $page - $neighbours;
    if ($left_neighbour < 1) $left_neighbour = 1;
    $right_neighbour = $page + $neighbours;
    if ($right_neighbour > $pages) $right_neighbour = $pages;
    if ($page > 1) {
        echo ' <a href="?page=1'.$tag.'">'.__('begin', 'blog').'</a> ... <a href="?page=' . ($page-1) . $tag.'"> '.__('prev', 'blog').'</a> ';
    }
    for ($i=$left_neighbour; $i<=$right_neighbour; $i++) {
        if ($i != $page) {
            echo ' <a href="?page=' . $i . $tag.'">' . $i . '</a> ';
        } else {
            echo ' <b>' . $i . '</b> ';
        }
    }
    if ($page < $pages) {
        echo  ' <a href="?page=' . ($page+1) . $tag.'">'.__('next', 'blog').'</a> ... <a href="?page=' . $pages . $tag.'">'.__('end', 'blog').'</a> ';
    }
?>

The fix is to update the file to reflect the url slug of your blog - for example blog

<br>
<br>
<?php
    if (Request::get('tag')) $tag = '&tag='.Request::get('tag'); else $tag = '';
    $neighbours = 6;
    $left_neighbour = $page - $neighbours;
    if ($left_neighbour < 1) $left_neighbour = 1;
    $right_neighbour = $page + $neighbours;
    if ($right_neighbour > $pages) $right_neighbour = $pages;
    if ($page > 1) {
        echo ' <a href="/blog?page=1'.$tag.'">'.__('begin', 'blog').'</a> ... <a href="/blog?page=' . ($page-1) . $tag.'"> '.__('prev', 'blog').'</a> ';
    }
    for ($i=$left_neighbour; $i<=$right_neighbour; $i++) {
        if ($i != $page) {
            echo ' <a href="/blog?page=' . $i . $tag.'">' . $i . '</a> ';
        } else {
            echo ' <b>' . $i . '</b> ';
        }
    }
    if ($page < $pages) {
        echo  ' <a href="/blog?page=' . ($page+1) . $tag.'">'.__('next', 'blog').'</a> ... <a href="/blog?page=' . $pages . $tag.'">'.__('end', 'blog').'</a> ';
    }
?>

This should fix any issues you have.