草庐IT

WP_DEBUG

全部标签

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 - xdebug ://debug-eval 中的未捕获异常 'ErrorException'

我正在使用Intellij14.1.4,PHPv5.5.38,Xdebugv2.2.3我做了一个更改,它定义了一个php$GLOBALS['CRED_TYPE']变量。我后来删除了那个变量。我到处检查,这个变量不再在任何地方定义。它只是不在我的代码中。但由于某种原因,我仍然遇到以下问题(!)Fatalerror:Uncaughtexception'ErrorException'withmessage'Undefinedindex:CRED_TYPE'inxdebug://debug-evalonline1(!)ErrorException:Undefinedindex:CRED_TYP

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

wordpress - 如何写没有标题的wp_mail

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

PHP 和 Facebook : facebook-debug a URL using CURL and Facebook debugger

事实:我经营一个简单的网站,其中包含文章、通过抓取第三方网站/博客等动态获取的文章(新文章每半小时左右到达我的网站)、文章我想在我的Facebook页面上发帖。每篇文章通常包括一张图片、一个标题和一些文本。问题:我在Facebook上发布的大部分(几乎所有)文章都没有正确发布——它们的图片丢失了。低效解决方案:使用Facebook的调试器(thisone)我向它提交一篇文章的URL(来self的网站的URL,而不是原始来源的URL)然后Facebook扫描/抓取该URL并正确提取所需的信息(图像、标题、文本等)。执行此操作后,文章可以正确发布到Facebook-没有丢失图片或任何内容。

php - 如何在 Laravel 上检查 Debug模式

我想在本地主机上工作时看到错误。App\Exceptions\handler.php我试过:publicfunctionrender($request,Exception$exception){if($this->isHttpException($exception)&&env('APP_DEBUG')===false){returnresponse()->view('errors.404',[],404);}else{returnparent::render($request,$exception);}}或;if($this->isHttpException($exception)&

php - wp_insert_post 带有表单

'$post-title','post_content'=>'$post-content','post_status'=>'publish','post_author'=>$user_ID,);if(isset($submitted)){wp_insert_post($new_post);}?>我在没有表格的情况下对其进行了测试,它运行良好。但出于某种原因,我似乎无法让它与表格一起工作。有什么想法吗?还有什么应该在表单的操作中进行?感谢您的帮助。 最佳答案 这应该有效。'','post_author'=>$user->ID,'pos