我想在管理面板中嵌入具有固定宽度的图像或 div 标签,以设置最小宽度。像这样的事情,
<div style="width:1000px; height:0px; border:0px;"></div>
Run Code Online (Sandbox Code Playgroud)
我找不到合适的钩子。此页面http://codex.wordpress.org/Plugin_API/Action_Reference列出了可用的挂钩,我尝试了其中一些,包括wp_before_admin_bar_render, wp_after_admin_bar_render。但嵌入图像为时已晚,因为图像#wpcontent已经加载并渲染。我也尝试过admin_head,但现在嵌入图像还为时过早;宽度没有任何影响。我需要将图像放在 #wpcontent 的 div 元素之前。我猜是在渲染左侧菜单之后。
是否可以?
在不同的 WordPress 版本中,直接在样式表中指定 #wpcontent 的宽度并不成功。所以我正在寻找替代方案。感谢您的信息。
我用它来为我的自定义主题获取 wordpress 评论:
get_comments( array('status' => 'aprove','order' => 'ASC', 'post_id' => $newpost->ID) );
Run Code Online (Sandbox Code Playgroud)
除了等待审核的评论未被过滤这一事实之外,一切正常。遵循法典:http : //codex.wordpress.org/Function_Reference/get_comment'status' => 'approve'应该过滤掉那些,但这似乎没有发生。
我没有正确使用它吗?
我有一系列自定义帖子类型的帖子。他们每个人都有一个特色图片(缩略图)和一个摘录。
我想在主页上显示 4 个项目,第一个项目的格式与其他 3 个项目的格式不同,例如在附加图像中。这是怎么做的?

我想按页面顺序列出 wordpress 页面顺序。默认顺序是按标题。
$pages = get_pages('child_of= 22&&title_li=&sort_column=> menu_order');
Run Code Online (Sandbox Code Playgroud)
我尝试了上面的一个。位它不起作用。是否有任何选项可以对订单字段进行排序
我正在开发wordpress中的多语言网站,我需要翻译阿拉伯语的网站内容,
我在这里使用,qTranslate Importer但每次都会出现这个错误
"Please save the qTranslate settings to the datbase first".
Run Code Online (Sandbox Code Playgroud)
即使我遵循此文档 请在这方面帮助我或建议我还有其他方式来翻译Wordpress网站的内容?(WP 3.6的任何插件)
php wordpress wordpress-theming web-deployment wordpress-plugin
我目前正在通过wordpress开发一个在线商店.一切都很好,现在我想给我的页面一个自定义边框(倒圆角),并找到它的CSS代码,如下所示:
CSS:
body {
background-color: #fff;
}
.wrapper {
overflow:hidden;
width:200px;
height:200px;
}
div.inverted-corner {
box-sizing:border-box;
position: relative;
background-color: #3e2a4f;
height: 200px;
width: 200px;
border: solid grey 7px;
}
.top, .bottom {
position: absolute;
width: 100%;
height: 100%;
top:0;
left:0;
}
.top:before, .top:after, .bottom:before, .bottom:after{
content:" ";
position:absolute;
width: 40px;
height: 40px;
background-color: #fff;
border: solid grey 7px;
border-radius: 20px;
}
.top:before {
top:-35px;
left:-35px;
}
.top:after {
top: -35px;
right: -35px;
box-shadow: inset 1px 1px 1px grey;
}
.bottom:before …Run Code Online (Sandbox Code Playgroud) 在我的 WordPress 网站private中,wp_nav_menu即使用户未登录,我也需要在主导航中显示链接(通过)(我只需要显示链接,而不是更改可以查看实际内容的人)。
我可以在其他地方执行此操作,使用wp_list_pages and指定要显示的 post_status(es),但我看不到如何将其应用于wp_nav_menu.
这有效:
wp_list_pages(array(
'title_li' => '',
'child_of' => $page->ID,
'post_status' => 'published,private'
));
Run Code Online (Sandbox Code Playgroud)
有没有办法做类似的事情?
wp_nav_menu(array(
'menu' => 'primary',
'theme_location' => 'primary',
'container' => FALSE,
'walker' => new MegaMenuWalker
'depth' => 2));
Run Code Online (Sandbox Code Playgroud)
到目前为止,我的搜索显示了多种对结果进行后处理以使用wp_get_nav_menu_items钩子过滤掉私人页面(或草稿)的方法,但我还没有找到相反的方法。
我想我可以做一个自定义查询来以这种方式抓取项目,但这不会让我使用我的自定义步行者。
诱人的是wp_get_nav_menu_items( $menu, $args ),它确实允许我指定 post_status 参数,但是我只能应用我自己的渲染而不是能够使用 walker...除非有某种方法可以在wp_nav_menu?
我正在开发一个自定义主题,并在该主题中包含了 acf pro,如文档中所述。主题工作正常,主题激活时激活了 acf。这是代码。
// customize ACF path
add_filter('acf/settings/path', 'my_acf_settings_path');
function my_acf_settings_path( $path ) {
$path = get_stylesheet_directory() . '/inc/advanced-custom-fields-pro/';
return $path;
}
// customize ACF dir
add_filter('acf/settings/dir', 'my_acf_settings_dir');
function my_acf_settings_dir( $dir ) {
$dir = get_stylesheet_directory_uri() . '/inc/advanced-custom-fields-pro/';
return $dir;
}
// Include ACF
include_once( get_stylesheet_directory() . '/inc/advanced-custom-fields-pro/acf.php' );
Run Code Online (Sandbox Code Playgroud)
我现在面临几个小时的问题是由于我想在 acf 中实例化的组/字段。我有一些想要在全新安装时显示的字段组。以下是我尝试过的方法:
方法 1:
我已将字段作为 json 导出到名为acf-json. ACF 确实识别它并显示为同步字段。但是当我尝试同步它时,它只会创建一个新的空字段。
方法 2: 我也尝试将字段组导出为 php 文件,然后将其包含在我的 functions.php 文件中,但 acf 无法识别此代码。
我正在尝试在 WordPress 菜单中的任何子菜单项之后添加一个 div。我正在处理functions.php文件中的以下代码:
add_filter( 'nav_menu_link_attributes', 'SubMenuCheck', 10, 3 );
function SubMenuCheck( $atts, $item, $args ) {
if (in_array('menu-item-has-children', $item->classes)) {
$args->after = '<div class="click">+</div>';
}
return $atts;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码添加了新的 div,<div class="click">+</div>但在第一个“menu-item-has-children”类之后继续将其应用于所有父项和子项:
有谁知道为什么这是重复的?...我只希望 div 显示menu-item-has-children该类的项目。
谢谢
我试图了解在 WP 中创建的主题。根据我的理解 wp_footer() 在主页中包含 footer.php 。但我不明白的是为什么 wp_footer() 像在 27 页脚中一样在 footer.php 中被调用?
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="wrap">
<?php
get_template_part( 'template-parts/footer/footer', 'widgets' );
if ( has_nav_menu( 'social' ) ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
) );
?>
</nav><!-- .social-navigation --> …Run Code Online (Sandbox Code Playgroud)