草庐IT

wp_customizer

全部标签

php - 如何从 WP 帖子对象获取任何帖子的日期月份和年份?WordPress

我正在尝试从WP帖子对象获取帖子的年月日。我所做的是:post_date;echo"";?>输出:2013-12-2613:25:18我需要的是,年月日:26Dec2013 最佳答案 使用这个:echodate("dMY",strtotime($cpost->post_date));这是PHP中日期函数的完整参数:datefunctionParameters. 关于php-如何从WP帖子对象获取任何帖子的日期月份和年份?WordPress,我们在StackOverflow上找到一个类似的

php - 如何删除 wp 简码中的 <pre> 标签?

我正在尝试创建一个短代码来显示最新的帖子。我使用了以下代码作为简码functionmy_recent_posts_shortcode($atts){extract(shortcode_atts(array('limit'=>5),$atts,'recent-posts'));$q=newWP_Query(array('posts_per_page'=>'.$limit.','post_type'=>'post'));$list='';while($q->have_posts()):$q->the_post();$list.=''.get_the_title().''.the_conte

php - WP_Query orderby meta_value_num 不起作用

我正在尝试按价格显示服务列表。我已经设置了自定义帖子类型和自定义字段等。但是,当我在页面上运行查询时,最昂贵的服务(100英镑)首先显示而不是最后显示...我编写的查询如下:$services=newWP_Query(array('post_type'=>'service','tax_query'=>array(array('taxonomy'=>'service_type','field'=>'name','terms'=>$post->post_name,),),'meta_key'=>'price','post_status'=>'publish','posts_per_page

php - WP 自定义帖子类型无法在上面的 woocommerce 3.0 中添加到购物车

我仍然可以通过向“woocommerce_product_class”添加过滤器来将自定义帖子类型添加到WooCommerce2.6中的购物车functionwc_product_class($class,$product_type,$post_type){if('my_custom_post_type_slug'==$post_type)$class='WC_Product_Simple';return$class;}add_filter('woocommerce_product_class','wc_product_class',10,3);//Thiswillechothecar

php - 将属性添加到 wp_get_attachment_image

我正在尝试为wp_get_attachment_image的结果添加一个属性.我想使用jquerylazyload来处理我的帖子缩略图的加载,为此我需要添加一个data-original=属性为标签wp_get_attachment_image正在创作。我试过:$imgsrc=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),"full");$imgsrc=$imgsrc[0];$placeholderimg=wp_get_attachment_image(2897,"full",array('data-origi

php - WooCommerce 法典 : how to set the user/customer on an order

我正在编写一个负责付款和交付的WooCommerce插件。现在我正在根据当前购物车创建订单。一切正常,元素和费用正确,唯一的问题是订单显示为“访客”,而不是当前登录的用户(即使正确的电子邮件地址该用户在订单上)。这是我的代码:$cart=WC()->cart;$checkout=WC()->checkout();$order_id=$checkout->create_order();$order=wc_get_order($order_id);$order->user_id=apply_filters('woocommerce_checkout_customer_id',get_cur

php - 使用 Advanced Custom Fields 和 Contact Form 7 显示表单

我希望我的用户能够输入ContactForm7简码到Wordpress编辑器中的自定义字段。我使用ACF创建了自定义字段我可以将该值拉到页面上,但是当我尝试将它包含在短代码中时,它会返回404。这段代码:返回:[contact-form-7404"NotFound"]如果我用这样的值创建一个变量:echo返回:[contact-form-7id="473"title="LearnMoreForm"]但是在将该值放入echodo_shortcode函数列表后,我得到了相同的404:我错过了什么? 最佳答案 TodoitWithACFp

wordpress - 如何写没有标题的wp_mail

wp_mail可以不用header写吗?函数的用法是问:这样可以用吗? 最佳答案 是的,如果您检查参数$headers下方的文本,说明其(字符串或数组)(可选)$to(stringorarray)(required)Theintendedrecipient(s).Multiplerecipientsmaybespecifiedusinganarrayoracomma-separatedstring.Default:None$subject(string)(required)Thesubjectofthemessage.Default

php - WordPress Admin : When placing a Custom Post Type as a submenu of a parent menu, 父菜单链接被 CPT 覆盖

我注册了一个自定义帖子类型,我不希望它有自己的菜单,而是想将它作为一个名为my-custom-parent-page.这是我的代码:register_post_type('my_custom_post_type',array('labels'=>array('name'=>__('Books','mcpt'),'singular_name'=>__('Book','mcpt'),),'supports'=>array('title','editor'),'show_ui'=>true,'show_in_nav_menus'=>false,'show_in_menu'=>'my-cust

php - FOSUserBundle 和 REST Api 调用 : How to use custom FormType?

我在我的Symfony2网站上使用FOSUserBundle。现在我正在开发一个API以允许通过RESTAPI调用进行注册。我已经覆盖了FOSUserBundle的RegistrationController:ApiRegistrationController.php:/***@Route("/user/",defaults={"_format"="json"},requirements={"_method"="POST"})**/publicfunctionregisterAction(Request$request){[...]$form=$formFactory->createF