wordpress-plugin

Getting WordPress to automatically show category permalink for only specific categories

随声附和 提交于 2019-12-11 20:04:58
问题 I have searched, here is the closes result. I am building a new wordpress site. I want most posts to have no category in the URL, simply www.site.com/title. However I do want the blog posts to be separate, so I'd like www.site.com/blog/title. I'd also like the option to add more like that in the future, for only specific categories, not the entire site. There are many questions similar to this here on stackoverflow but most have 0 replies. Any advice would be great. I've even tried Advanced

WordPress Advanced Custom Fields - Random Query Repeater by SubField value

我的未来我决定 提交于 2019-12-11 19:53:57
问题 I'm trying to fetch ONE random row of testimonials, however that row must contain a "true" value for sitewide_display subfield. I can't for the life of me get this to work, this just gives me whatever result it feels like upon refresh. Is there some sort of conflict with using the conditional for the sub-field value (sitewide_display) within the while loop like this? <?php $rows = get_field('testimonials' ); // get all the rows ?> <?php if( $rows ) : // if there are rows, continue ?> <?php

Wordpress Future Page Issue (Not Showing)

我怕爱的太早我们不能终老 提交于 2019-12-11 19:48:21
问题 I've been asked to fix a problem on a wordpress site. The problem is caused by the fact posts should of been used instead of pages. However the site is up and running and quickest option would be to fix the problem using a hack of sorts. The site has an events section, each event is a page (this is the issue, should really be a post). In order to have upcoming and past events the post date is used, therefore upcoming events has a post status of 'future'. There's are list page of events which

Json_encode umlauts output

主宰稳场 提交于 2019-12-11 19:44:35
问题 I want to show my output in German umlauts, i got my output like this for example Fu009\ but i need "fü" like this. <?php $json = (object) array( "salutation" = > ''.$order - > order_custom_fields['_billing_anrede'][0]. '', "title" = > ''.$order - > order_custom_fields['_billing_titel'][0]. '', "first_name" = > ''.$order - > order_custom_fields['_billing_first_name'][0]. '', "last_name" = > ''.$order - > order_custom_fields['_billing_last_name'][0]. '', "street" = > ''.$order - > order_custom

Wordpress set default title when creating a new custom post

微笑、不失礼 提交于 2019-12-11 19:34:24
问题 I have a custom post type with just two (text)fields: an ISBN number and a youtube url by using 'supports' => array('title') when creating my custom post type. The problem is, I don't need a title. So when I save my post, I made it so that the title becomes the ISBN number. add_filter('wp_insert_post_data', array($this, 'change_title'), 99, 2); function change_title($data, $postarr) { if ($data['post_type'] == 'book_video') { // If it is our form has not been submitted, so we dont want to do

Make Only Accessible to Feed URL on a WordPress Site

安稳与你 提交于 2019-12-11 19:06:40
问题 I'm wondering if it is possible to write a plugin which shows nothing but only let the visitor access the feed url. The admin page should be accessible by the administrator as well. The background of this idea is that I've written a custom feed generator and implemented it in a WordPress site. Since the site is only for the feeds, I'd like to make the site invisible to the public except the feed outputs. I'm aware that there are Maintenance Mode and Members Only plugins. The problem is that

How to refresh wordpress plugin in a period of time that i selected?

*爱你&永不变心* 提交于 2019-12-11 18:46:56
问题 I wrote a plugin for wordpress and i want it to refresh in every 3 hours i tried header("refresh:10800;url=example.php") but i couldn't get any result. Thanks for your helps. 回答1: you could try with javascript: setTimeout(function(){ window.location = 'example.com' },10800) let us know how you get on in 3 1/2 hours or so... 回答2: You've gotten confused between the PHP header() function and the HTML HEAD section. The PHP header( 'Location: newpage.htm' ); performs an instantaneous redirect to

Wordpress - hooking into saving post data

旧巷老猫 提交于 2019-12-11 18:39:40
问题 This piece of code is supposed to set post data if post custom field is set to true, or set post status to draft, if it is not. The action needs to be called after post_save / post_updated action, so one of our colleges suggested me the way (old question: wordpress set post_status as "draft" in 'save_post' action): add_filter( 'wp_insert_post_data', 'set_post_parameters', 99, 2 ); function set_post_parameters( $data, $postarr ) { if ( get_post_meta( $postarr['ID'], '_cs_tweet_ok_status', true

Adding content before the loop

人走茶凉 提交于 2019-12-11 14:38:32
问题 Is there a way to add content before the loop through a WordPress plugin? Specifically, I'm looking to add HTML to the content area, before the posts (both in post lists AND individual posts) Here's a screenshot of the ideal placement: http://note.io/1ne3J73 Is this at all possible to work across all themes? 回答1: This could be tricky simply because every theme differs with how the loop is displayed, however you could create a plugin to use the loop_start action, which is called before the

Running glob() from an included script returns empty array

我们两清 提交于 2019-12-11 14:15:19
问题 Perhaps I'm over-looking some minor error somewhere, however I have spent 20 minutes staring at this and re-reading the PHP manual, which is far too long for me to spend on a single line of code. I am writing a WordPress plugin which is implemented as a class. In my plugin I have the following line: $choices = glob(dirname(__FILE__)."/images/*.{gif,jpg,jpeg,png}", GLOB_BRACE); Clearly I want $choices to be an array containing every image in the "images" folder, relative to the included file.