如何从wordpress数据库获取缩略图到外部页面 [英] How to get thumbnail from a wordpress database into an external page

查看:35
本文介绍了如何从wordpress数据库获取缩略图到外部页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 wordpress 安装.我想做的是直接从数据库中的 wordpress 表中调用数据,并将它们显示在其他一些非 wordpress 页面上.

I have a wordpress installation. What i'd like to do is call data directly from the wordpress tables in the database and display them on some other non-wordpress pages.

目前我成功地从 wp_posts 表中提取了三个最新的帖子.但是,我无法在存储帖子缩略图(或特色图片)的架构中看到.

At the moment i'm successfully pulling in the three most recent posts from the wp_posts table. I can't however see in the schema where the post thumbnail (or featured image) are stored.

如何获取特色图片或缩略图?(两者都行!)

How can I get either the featured image, or thumbnail? (either will do!)

提前致谢!

推荐答案

一切尽在 wp_postmeta table

Its all in you wp_postmeta table

将查询某个帖子 ID 的缩略图 ID(您需要有您的帖子 ID).

will query the thumbnail ID of a certain post ID (you need to have your post IDs).

SELECT * FROM 'tksql_postmeta' WHERE post_id=1 AND meta_key='_thumbnail_id'

想象一下返回的拇指id是:600

Imagine the returned thumb id is : 600

SELECT * FROM 'tksql_postmeta' WHERE post_id=600 

会给你两行:meta_key="_wp_attached_file" 将给出 urlmeta_key="_wp_attachment_metadata" 将提供尺寸等元信息

will give you two rows : meta_key="_wp_attached_file" will give url meta_key="_wp_attachment_metadata" will give meta info like size etc

希望这有助于更好

这篇关于如何从wordpress数据库获取缩略图到外部页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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