I'm using Fishpig to pull in blog posts from WordPress and everything is working fine. However, on /blog instead of having the blog posts displayed in their full length I'd like to use excerpts from the posts (similar to WordPress's method of showing posts in archive/category/ect).
I found default.phtml under app/design/frontend/base/default/template/wordpress/post/list/renderer/default.phtml and see that on line 21 is <?php echo $post->getPostExcerpt() ?>
When commenting this out the content from the posts on /blog no longer shows, indicating I'm in the right file. I really wish I could just use get_excerpt(); here. How/what do I modify to pull in an excerpt instead so the blog pages listing posts don't just pull in the entirety of each post?
To show an excerpt, you have 3 different options:
1) Go to your post in the WordPress Admin and manually enter a post excerpt in the post excerpt field. This field is located just below the post content field. If this isn't visible, click the 'Screen Options' tab at the top of the page and enable the post excerpt field.
2) Go to your post in the WordPress Admin and use the More tag/button to split the post. Every thing before the More tag will be used as the post excerpt. You can find out more about the More tag at the following URL:
http://en.support.wordpress.com/splitting-content/more-tag/
3) Open the list template (wordpress/post/list/renderer/default.phtml) and add some PHP code to shorten the post content.
Copy the default.phtml file from /base/default/template/wordpress/post/list/renderer/ in to your theme with same folder structure. Then comment the lines that cause for post description and add below code.
$content = $post->getPostExcerpt();
$content = strip_tags($content);
echo substr($content, 0, 250);
Related
the problem:
we are porting a wordpress blog to lektor. The slugs in wordpress of the post are directly under the main domain e.g. www.mypage.com/my-blogpost-about-food/ not www.mypage.com/blog/my-blogpost-about-food/.
Now the owner is not ready to accept any broken links. Broken links from the outside, e.g. some random internet page links to www.mypage.com/my-blogpost-about-food/. This link will not work in lektor. This will decrease the page rank of the redesign of the page with lektor. What can I do to avoid this?
Again, in our current wordpress website
the main blog page sits under:
www.mypage.com/blog/
each blog post has a unique slug, NOT under /blog/ but directly in the main.
e.g.
www.mypage.com/my-blogpost-about-food/
What can I do, to make these URLs be valid for lektor as well? that e.g. mypage.com/my-blogpost-about-food is a blog post.
EDIT: this is what lektor does not support. Blog posts in lektor must sit in www.mypage.com/blog/SINGLE-BLOG-POSTS-MUSTBEHERE but I want the blog posts to be here www.mypage.com/SINGLE-BLOG-POSTS-MUSTBEHERE
reading here
https://www.getlektor.com/docs/content/urls/
if I go to the system fields and enter my-blogpost-about-food it will still appear in /blog/my-blogpost-about-food/
reading here it becomes clear that I cannot change the slug in the parent model neither:
With the above settings the blog will live at blog/ and the posts at
blog/. But what if you want to put the date of the blog
post into the URL? That's thankfully very easy. All you need to do is
to set up a new URL format for the children. Just edit blog.ini and
add this to the [children] section:
slug_format = {{ (this.pub_date|dateformat('YYYY/M/') if this.pub_date) ~ this._id }}
What this does is that it will prepend the year (YYYY) and month (M)
to the ID of the page if the publication date is configured. Otherwise
it will just use the ID of the page. With this change our blog post
will move from for instance blog/hello/ to blog/2015/12/hello/.
now how would I achieve a behaviour similar to this?
this is the formal of the perma links of our wordpress installation:
This is possible. If you started with the default setup from lektor quickstart:
In models/blog-post.ini, remove hidden = yes
In models/blog.ini, under the pagination section, add items = site.query('/').filter(F._model == 'blog-post')
The first step lets you create blog posts under root in the admin.
The second step tells the page blog to look for its pagination items under /, and only include the ones of type blog-post. This will exclude e.g. About, Blog, etc.
You will now have your site's home page at /, a blog page with list of all posts at /blog, and each post will be located at example.com/my-blogpost-about-food/.
To create a new blog post in the admin, go to the root admin page (not the /blog admin page), click the +, and select Blog Post for your new page type. It will show up in the list on /blog, and live directly under /.
I'm not certain I understand exactly what you want to achieve. If I understand correctly you can possibly solve this using the replaced_with for children functionality:
https://www.getlektor.com/docs/guides/categories/
I have just one trouble adding fb comments box in my site. I use kust one url and read the content of the site using js. I put in the head the init of my fb app but I have three post in the main page and I want one comment box for every post. To load the comments of my post I use ((myurl)){{post.id}} to make unique the comment box. This url dosen't exist. But show me up difference comment for every. But don't let me moderate.. I mean dont show the moderation tool. But if i change the href of the post to my url real. Show me the noderstion tool but the same comments in every posts. Any idea???
The page is by ajax bwcause is a radio station and need to listwn the station y all contwnt. There is any way to assign thw url "manualy" in thw api of fb?
I have a list of FAQ links on my home page in a static block in the footer. Each link however just opens up the FAQ page.
My code sample
What is Individually Quick Frozen?</li>
What I want is that when a user clicks a particular link in the list on the homepage footer under FAQs (as above), the user should be directly be taken to the answer of that question on the FAQ page i.e. the page should scroll down to where the questions is answered.
My Code sample
<p><strong><a id="1">What is Individually Quick Frozen?</a></strong></p>
But no joy! what am I doing wrong?
Make your link look like this:
What is Individually Quick Frozen?</li>
or better yet
What is Individually Quick Frozen?</li>
Note: For Cms pages urls use direct_url as a parameter for the {{store}} directive. It avoids having a / at the end of the URL. Useful if your pages end with .html. It's not your case but it may be useful in the future.
Now your code in the cms page should looks like this:
<p><strong><a id="_1">What is Individually Quick Frozen?</a></strong></p>
Avoid using numerical ids for elements. It's not standard
Worked perfectly, be sure to update
<a href="{{store url="faqs"}}#_1">
"faqs" to what ever page you want your tag to land on though.
On all my Joomla pages I have the articles title as the h1 tag, so until now, Joomla has always displayed the title, i.e. what you see on the browser tab as the h1 tag. (There were one and the same thing).
However, this is not the case with all the pages that have no menu item linking to them, (they are linked to the rest of the site through another article). Here the name of my site is the page title.
How do I make the h1 tag the page title on these pages?
Try this,
This is happen due to those article pages meta options have title, Meta tag and keywords those are blank or not set yet. Then this case Joomla will read those info from your Global settings It may have your site name and Global description.
So the solution is set the Proper meta info for those articles from article manager.
If it is not practical then you can try it from article view or layout page Set meta data of Joomla page
Second Method is for setting the page title forcefully from scripts. It used for any components like here you have to check first method it will work for you..
Hope its Helps..
Problem solved! Here is how:
Make an override of com_content article and edit the default.php. Around lines 42/43 you should have the following code (the line number may not be exact as I have already taken out some code for a previous override):
<?php if ($params->get('show_title') || $params->get('show_author')) : ?>
Straight after that, add the following lines of code:
<?php $document=& JFactory::getDocument();
$document->setTitle( $this->item->title ); ?>
I need to show comments on separate page, on the page itself, so there will be only link to the comment page like www.example.com/my-post/comments (and great would be also to have /my-post/comments/name-of-some-comment for every single comment).
any idea, how can i do it? E.g. some plugin? I have not found anything.
You do not need any plugin. basically you just need to copy either post or page template, which already has both post/page body and comments and then remove everything but the comments.
Check wordpress codex:
Template Tags
Custom Page Templates
Query-based Template Files
Conditional Tags
Most likely you will need to create your own conditional tag, or just check for particular query string (GET) parameter and apply your custom template