Skip to Content
WordPress:缺失的手册,第三版
book

WordPress:缺失的手册,第三版

by Matthew MacDonald
May 2025
Beginner to intermediate
492 pages
7h 35m
Chinese
O'Reilly Media, Inc.
Content preview from WordPress:缺失的手册,第三版

第 7 章: 添加图片、视频和更多内容

在上一章中,在文章中加入了标题、列表和其他花哨的格式。如果你主要关注的是如何让文本块看起来更美观,那么这很好。但如果你想在拥挤的网络世界中脱颖而出,在众多争夺注意力的网站中脱颖而出,你就需要更多。您需要添加丰富的媒体,如图片、视频和交互式小工具。

WordPress 为您提供了各种各样的区块,这些区块专为不同类型的内容而设计。在本章中,你将学习如何使用它们。首先,您将添加普通图片以及一些更精细的细节(如标题、栏目和图库)。然后,你将学习如何显示来自其他网站的内容,如 YouTube 视频、SoundCloud 播放列表,甚至是 Kickstarter 项目。正如你所看到的,WordPress 让一切变得简单。

添加基本图片

在网络上,文字和图片 通常存储在不同的文件中,在 WordPress 的世界里也是如此。要将图片放入 WordPress 帖子,您需要将图片文件上传到您的网站。您可以使用熟悉的帖子编辑器来完成这一操作。具体方法如下

  1. Go to the post editor.

    您如何来到这里并不重要。您可以创建一个新的帖子,也可以编辑您之前写的内容。Go 到帖子中要插入图片的位置。

  2. 单击 "添加区块 "按钮,然后选择 "图像"。

    当您添加图像块 时,一开始它是一个空的占位符框。其中除了几个按钮外什么都没有(图 7-1)。下面是这些按钮的作用:

    上传从电脑中抓取图片。这是您首先要尝试的方法。

    媒体库 使用网站上已有的图片(因为您之前已经上传过)。

    从 URL 插入 抓取已经在线的图片。例如,它可能在你管理的其他网站上,或者在http://pixabay.com 这样的免费图片共享服务上。要使用它,只需提供指向图片的网站地址即可。

    提示 从 URL 插入功能是有风险的,因为它不会将图片复制到你的网站。您使用的图片有可能被移动、重命名或删除,在这种情况下,它也会从您的页面上消失。为了安全起见,请先将图片下载到电脑上,然后再使用上传按钮。当然,除非得到他人允许,否则不要使用他人的图片。

    图 7-1

    添加图片有三种方法,图片块占位符中的三个按钮代表了这三种方法。

  3. 点击上传。

    WordPress 会弹出一个标准的文件浏览窗口。

  4. 找到想要的图片,选中它,然后单击 "打开"。

    确保您选择的图片类型是网络浏览器可以理解的。常见的标准 包括 JPEG (.jpg) 、PNG (.png) 和 GIF (.gif) 文件。不要使用 TIFF 文件(.tif)或未压缩的位图(.bmp)。

    WordPress 会花几秒钟将图片上传到您的网站。然后将图片插入图片块(图 7-2)。

    提示 您可以使用拖放作为上传图片的快捷方式。首先在电脑上找到图片文件,而不是点击上传按钮。(如果不在桌面上,请使用 Windows 的 Windows 资源管理器或 Mac 的 Finder)。然后单击图片文件,将其拖动到网页浏览器窗口上,并将其释放到图片块上。

    图 7-2

    你的网站需要这张青蛙在浴缸里悠闲地躺着的图片吗?当然需要。

  5. 可选择调整图片大小.

    WordPress 会自动将图片调整为全尺寸(或在符合主题布局的前提下尽可能放大)。但如果您想缩小图片,只需拖动图片右侧或底部边缘的蓝色大小条即可 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Three Traps That Stymie Reinvention

The Three Traps That Stymie Reinvention

Ryan Raffaelli
The Human Factor in AI-Based Decision-Making

The Human Factor in AI-Based Decision-Making

Philip Meissner, Christoph Keding

Publisher Resources

ISBN: 9798341657953