如何自定义主页上的WordPress的the_content()? [英] How to customize the_content() on Wordpress for the homepage?

查看:838
本文介绍了如何自定义主页上的WordPress的the_content()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图自定义一个WordPress主页,完全是the_content()函数。
我尝试使用的网站是 http://sportsponsorizzazioni.com/



如果在关于loop的文件中使用函数 the_content(),它会给我一个主页上的完整文章列表, 包含在帖子正文中的图片和我想要的文本格式。
以另一种方式使用the_excerpt()函数,仅显示摘录文本,如5行,不包含任何图像。



我只想显示在我的主页上,文章的第一部分,后面有read more按钮和图像,但后来我对the_content('')进行了子字符串操作,它只给出我第一个X字符,但没有图像...即使在我的帖子标签是在帖子的开始。



我需要一些自动的,不能添加一个thumbnail image还是每个帖子上的精选图片,是否有修改the_content('')的方法,让我仅举例说明我的文章的前30个字与图像?
或者(更好)有没有办法在the_excerpt()中包含我的文章中编码的图片?

非常感谢!

解决方案

插件完全正是你想要做的。请参阅FAQ部分中的第4项,以便从发布内容中提取图片。


I'm trying to customize a wordpress home page, exactly, the_content() function. the website I'm trying to use is http://sportsponsorizzazioni.com/

If in the file about "loop" I use the function "the_content()" it gives me a list of full articles on the home page, with the image I've included in the post body and the text formatted as I want. Using the function "the_excerpt()" in an other way, show me only the excerpt text, like 5 rows, without any image.

I just want to display on my home page, the first part of an article, with "read more" button after, and the image, but then I do a substring operation on the_content(''), it only gives me first X characters but without image... even if in my post the tag is on the start of the post.

I need something automatic, can't add a "thumbnail image" or a "featured image" on every single post, is there a way to modify "the_content('')" to let me take for example only the first 30 words of my post with the image? Or (better) is there a way to include in "the_excerpt()" the image coded in my article?

Thanks a lot!

解决方案

This plugin does exactly what you're trying to do. See item number 4 in the FAQ section for pulling images from post content.

这篇关于如何自定义主页上的WordPress的the_content()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆