wordpress自定义

以下是为您整理出来关于【wordpress自定义】合集内容,如果觉得还不错,请帮忙转发推荐。

【wordpress自定义】技术教程文章

WordPress自定义查询WP_Query使用方法大全【代码】

自定义调用文章在网站建设中很常用,wordpress也很人性化,用新建查询new WP_Query就能实现相关功能。WP_Query怎么用呢?随ytkah一起来看看吧  我们知道wordpress的主循环<?php if ( have_posts() ) : while ( have_posts() ) : the_post();the_title();endwhile; endif; ?>但其实是隐藏了一些参数,比如<?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();the_title();endwhil...

wordpress自定义url参数实现路由功能的代码示例

经过两天的正则表达式的学习,和研究wordpress的路由函数,成功实现了自定义wordpress路由功能,以下是路由规则的实现。如果有自定义的url参数,要通过路由传递,必须通过wordpress的函数将参数添加进去:复制代码 代码如下://add query_argsfunction add_query_vars($aVars) { $aVars[] = ‘score‘; $aVars[] = ‘type‘; // represents the name of the product category as shown in the URL return $aVars;}add_filt...

php – WordPress:自定义用户没有出现在作者框中【代码】

我在Wordpress中添加了自定义用户类型,自定义帖子类型支持作者(见下文).自定义用户类型具有作者的所有权限,但“发布帖子”除外,但不在要分配给帖子的可能作者列表中. 我究竟做错了什么? 码:if (!get_role('member')) {add_role('member', 'SFUK Member', array('delete_posts' => true,'edit_posts' => true,'read' => true,'upload_files' => true,'edit_published_posts' => true,'delete_published_posts' => true)); }这是自...

使用wordpress自定义字段图像上传时$_FILES为空,但是它在核心php网站上工作【代码】

<form enctype="multipart/form-data" method="post" action="uploader.php"><input type="file" name="pic" /><br /><input type="submit" value="Upload File" /></form>$file_title = $_FILES["pic"]["name"]; echo "$file_title";在wordpress functions.php文件中;自定义字段方法是:function credits_meta() {global $post;$custom = get_post_custom($post->ID);$designers = $custom["designers"][0];$developers = $custom...

php – WordPress自定义小部件记住多个选择选项【代码】

我正在为我们的网站编写一个自定义小部件来显示一些选定的帖子.在管理部分,我有一个多选框,让管理员按名称选择多个帖子.这工作正常,但是当我选择几个不同的帖子并保存时,没有任何东西被保存. 任何人都可以对此有所了解吗? 这是我的代码……<?php /* Plugin Name: Hot Topics Plugin URI: http://www.weddingideasmag.com Description: Use this widget to choose an array of posts snippets to show Version: 1.0) Author: Jame...

php – wordpress自定义查询选择元值【代码】

SELECT b.post_title, a.post_id, COUNT( * ) as Total FROM wp_posts b INNER JOIN wp_postmeta a ON a.post_id = b.IDWHERE a.meta_value = 1AND a.meta_key = 'type-select' AND b.post_status = 'publish'and post_type = 'car-cc' GROUP BY b.post_title, a.post_id目前它选择帖子标题和帖子ID,但我还需要选择元值,其中元键=类型 – 问题是另一个元键已经在查询中进行了比较. SQL小提琴:http://sqlfiddle.com/#!2/109c2/1解...

php – 在WordPress的自定义表中是否有LEFT JOIN的替代方案?【代码】

我在WordPress数据库中有两个自定义表.table1: id | title | etc table2: id | table1_id | title | source | etc我有这个左连接工作完美:select p.title as ptitle, e.id, e.title, e.source, e.etc FROM table2 AS e LEFT JOIN table1 AS p ON p.id = e.table1_id where e.table1_id = 1返回这个:ptitle1 | id1 |title1 | source1 | etc1 ptitle1 | id2 |title2 | source2 | etc2 ptitle1 | id3 |title3 | source3 | et...

php – WordPress自定义帖子类型未显示在搜索结果中【代码】

我有自定义帖子类型(测验)&在WordPress中搜索.自定义帖子类型未显示在我的搜索结果页面中.我的搜索结果中只显示默认的帖子内容. 以下是我使用的代码 的functions.php function create_posttype(){register_post_type( 'compassquiz',array('labels' => array('name' => __( 'Compass Quiz' ),'singular_name' => __( 'Compass Quiz' )),'taxonomies' => array('post_tag'),'public' => true,'publicly_queryable' => true,'has_...

php – WordPress在自定义页面上设置自定义标题【代码】

我正在尝试创建完全自定义页面,但使用相同的功能在WP中创建页眉和页脚.我在我的页面上有这个<?php include("../wp-blog-header.php"); get_header(); ?> <title>My Custom Title Here</title> <?php wp_head(); get_footer(); ?>页面显示一切正常,但是当我尝试添加< title>我的自定义标题在这里< / title>在get_header()之后我在我的页面源代码中找到了这个标题页面未找到我的自定义标题 如何设置自定义页面标题?我的意思是在页面...

php – WordPress:自定义帖子类型,发送数据到“register_meta_box_cb”Arg【代码】

我正在向WordPress网站添加多个自定义帖子类型,我正在尝试使用变量和合并函数来优化代码.我能够将2个变量发送到用于register_post_type的create_rma_project_post_type函数.我想对附加元数据创建函数的参数做同样的事情.下面的第一个代码完全有效.它使用register_meta_box_cb来调用add_project_metaboxes:add_action('init', create_rma_project_post_type('project','our-people')); function create_rma_project_post_type($pos...