我使用register_post_type函数创建了一个自定义的帖子类型,现在我想为它添加自定义字段.这些必须尽可能用户友好并在GUI中进行集成.
我尝试了自定义字段模板,但我不喜欢最终用户.我更喜欢添加新字段和带代码的新元框.
这可能是一个微不足道的问题,但我对Wordpress中" 自定义字段 "," 元框 "和" 分类法 " 之间的区别感到有些困惑.
例如,如果我要创建一个名为"Movie"的自定义帖子类型,其中包含"Actor"和"Genre"的附加字段,那么这些附加字段会被调用?
关于masonry.js,我有一个奇怪的问题,我似乎无法找到其他任何地方.
我有最新的(3.10)版本,我将它包含在我的wordpress主题的functions.php文件中,如下所示:
function enqueue ()
{
wp_register_script( 'masonry', get_stylesheet_directory_uri() . '/js/masonry.js', array( 'jquery' ) );
wp_enqueue_script( 'masonry' );
}
add_action( 'wp_enqueue_scripts', 'enqueue');
Run Code Online (Sandbox Code Playgroud)
哪个加载脚本很好.就像现在一样,我没有做任何其他事情,但脚本失败了:
Uncaught TypeError: Cannot call method 'create' of undefined masonry.js?ver=3.5.2:37
Run Code Online (Sandbox Code Playgroud)
好像它不能在窗口上调用create.Outerlayer因为它不存在.
这是有问题的代码,从第34行开始,来自masonry.js:
// used for AMD definition and requires
function masonryDefinition( Outlayer, getSize ) {
// create an Outlayer layout class
var Masonry = Outlayer.create('masonry');
Masonry.prototype._resetLayout = function() {
this.getSize();
this._getMeasurement( 'columnWidth', 'outerWidth' );
this._getMeasurement( 'gutter', 'outerWidth' );
this.measureColumns();
// reset column Y
var …Run Code Online (Sandbox Code Playgroud) 我想用Bootstrap 3制作一个响应主题.但是,我需要自动将CSS类添加.img-responsive到每个帖子图像,因为我需要图像响应.
请建议我在WordPress的functions.php文件或任何其他文件中添加我需要自动添加CSS类的内容.
Wordpress主题很漂亮!
是否有任何指南在rails应用程序中使用Wordpress主题?更好的是,是否有可以使用Wordpress主题的rails app模板?
谢谢!
我想引入一个动态的侧边栏.我在小部件侧边栏中有1个文本项,但我不想在小部件中引入标题(只是正文).任何人都可以告诉我WordPress在标题中的位置吗?
我现在......
// In my page template...
<div id='advert-header'>
<?php dynamic_sidebar( 'Header Advert' ); ?>
</div>
// In functions.php...
function twentyten_widgets_init() {
register_sidebar( array(
'name' => __( 'Header Advert', 'twentyten' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'twentyten' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
// etc.
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个主题,我在标题中显示一个搜索框:
<?php get_search_form(); ?>
Run Code Online (Sandbox Code Playgroud)
有没有办法让占位符文本显示在该框中?
我有一个主题,扩展了Visual Composer插件,在首页上有一个滑块.滑块将显示来自五个不同客户的五个推荐.我想将每个推荐的特色图像添加为滑块中的缩略图.
这是来自父主题的缩短代码:
function jo_customers_testimonials_slider( $atts ) {
extract( shortcode_atts( array( 'limit' => 5, "widget_title" => __('What Are People Saying', 'jo'), 'text_color' => "#000" ), $atts ) );
$content = "";
$loopArgs = array( "post_type" => "customers", "posts_per_page" => $limit, 'ignore_sticky_posts' => 1 );
$postsLoop = new WP_Query( $loopArgs );
$content = "";
$content .= '...';
$content .= '...';
$content .= '...';
wp_reset_query();
return $content;
}
add_shortcode( 'jo_customers_testimonials_slider', 'jo_customers_testimonials_slider' );
Run Code Online (Sandbox Code Playgroud)
我的functions.php文件:
function jo_customers_testimonials_slider_with_thumbnail( $atts ) {
extract( shortcode_atts( array( 'limit' …Run Code Online (Sandbox Code Playgroud) 在使用WordPress时,是否可以像在CSS中一样使用CSS获取背景图像.我试过这样做,但它不起作用.
background-image: url("<?php bloginfo('template_directory'); ?>/images/parallax_image.jpg ");
Run Code Online (Sandbox Code Playgroud)