Click here to Skip to main content
15,897,718 members
Articles / All Topics

How to Add Excerpts to your WordPress Blog Homepage in a TwentyThirteen Theme and Not Break the Codeproject Importer

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
3 Aug 2015CPOL 14.9K   3  
Adding excerpts to your WordPress blog homepage in a twentythirteen theme without breaking the CodeProject importer

As you may know, CodeProject has a thing called Technical blogs which lets you publish your post on their site too, thus widening the range of potential readers.

Thanks to a great plugin by hjgode, you can automatically import your posts.

However, recently I wanted just to show excerpts of the posts on my blog homepage and in the archives. The problem was that that stopped the importer from collecting the posts that are marked with the codeproject category because the posts were too short according to their rules (1000 words minimum).

I solved this in my TwentyThirteen theme by making slight changes in content.php (around line 33), which by default looks like this:

PHP
<?php if ( is_search() ) : // Only display Excerpts for Search ?>

This line displays excerpts only on a search page, and to show excerpts on homepage, I did:

PHP
<?php if ( is_search() || is_home() ) :  ?>

You just have to make sure that you don’t include the:

PHP
is_category()

and you’re all set.

True, you could further optimize this in a way that you would show excerpts for all other categories except “codeproject”.

The post How to add excerpts to your WordPress blog homepage in a TwentyThirteen theme and not break the Codeproject importer appeared first on Nikola Brežnjak blog.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Croatia Croatia
I’m an engineer at heart and a jack of all trades kind of guy.

For those who care about titles, I hold a masters degree in computing from FER (and a black belt in karate, but that’s another story…).

During the last years, worked in a betting software industry where I made use of my knowledge in areas ranging from full-stack (web & desktop) development to game development through Linux and database administration and use of various languages (C#, PHP, JavaScript to name just a few).

Currently, I’m a senior software engineer at TelTech, where we make innovative communications apps, and I <3 it.

Lately, I’m very passionate about Ionic framework and am currently in the top 3 answerers on StackOverflow in Ionic framework. I wrote a book about Ionic framework which you can get for free on Leanpub: Ionic framework – step by step from idea through prototyping to the app stores.

Other technical writing:

+ wrote a book Getting MEAN with MEMEs
was a technical reviewer for a book Deploying Node published by Packt
was a technical reviewer for a book Getting started with Ionic published by Packt
After writing 300 posts, this is why I think you should start blogging too

Come and see what I write about on my blog.

Comments and Discussions

 
-- There are no messages in this forum --