我想在公司页面上显示博客的内容。然而,我被缩略图卡住了——我已经分配了一个新的图像尺寸(64x48px),我必须得到它的 src。
这是我得到的代码,但它并没有按照我想要的方式工作。
<?php
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
?>
<?php
global $post;
$args = array('posts_per_page' => 3, 'category' => 632);
$externalSitePosts = get_posts($args);
foreach($externalSitePosts as $post) : setup_postdata($post);
?>
<?php
//This one gets me the src of the original file (full)
$thumbnail = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'myResizedThumbnail'));
echo $thumbnail;
//This one displays the properly generated thumbanil image with the size as assigned in functions.php (64x48), I need the src though
$thumbnail1 = the_post_thumbnail('myResizedThumbnail');
echo $thumbnail1;
?>
<?php endforeach; ?>
谢谢!:)