wordpress-plugin

List custom data in Wordpress

余生长醉 提交于 2019-12-06 10:48:29
I'm developing a plugin which has its own table. I need to display the data from the table in the Wordpress frontend (for example: category page). I don't need to JOIN this table with posts table, I just need to display the data from the table, with pagination. I need a separate page/custom template from my plugin directory (talking in a context of MVC frameworks — controller), on which this data should be displayed and paginated. Please give me an advice, what is the best practice to implement it? Thanks. If I understood your question then I think you need to add template_include hook to use

Need help with remove_action()

十年热恋 提交于 2019-12-06 10:38:59
I'm trying to remove the unsightly embedded <STYLE> tag the built-in Recent Comments widget puts in my <HEAD> , but I can't seem to get the syntax right. It originally calls add_action( 'wp_head', array(&$this, 'recent_comments_style') ); to add it (in wp-includes/default-widgets.php, line 609 ), and I'm trying to undo it. I think it should be something like this: remove_action('wp_head', 'WP_Widget_Recent_Comments::recent_comments_style'); but with all the variations I've tried I still can't get it right. Does anyone know how to achieve this? Possibly Helpful: Function Reference: remove

Does a PHP library exist to work with PRC/.mobi files?

怎甘沉沦 提交于 2019-12-06 10:26:16
问题 I'm writing a WordPress plugin to create an eBook from a selected category in most major eBook formats. I would like to support MobiPocket since that's the format used by the Kindle but I'm not sure how to go about it. From what I've read .mobi files are actually Palm Resource Databases (PRC) but I haven't been able to find a PHP class to work with these. I thought about using exec along with KindleGen but that would be undesirable as it would complicate initial setup. I've also thought about

overwrite the search function in wordpress (sql and php)

♀尐吖头ヾ 提交于 2019-12-06 09:07:55
问题 Is there a way to overwrite the default search function in wordpress? I have tried using the filters, but they only allow adding to the query... or possibly rewriting the whole query using posts_request. If I overwrite that though, no other querys will work. I have the following code function my_posts_request_filter($input) { if ( is_search() && isset($_GET['s'])) { global $wpdb; } return $input; } add_filter('posts_request','my_posts_request_filter'); I could override $input with my custom

PHP - Wordpress - Plugin Widget Update Function - Update array values [Foreach Loop not Working]

别说谁变了你拦得住时间么 提交于 2019-12-06 07:49:54
问题 i am in the process of developing a wordpress plugin with a widget. Currently the update function for the widget looks like this. function update($new, $old){ $instance = $old; //Update Values $instance['element-one'] = $new['element-one']; $instance['element-two'] = $new['element-two']; $instance['element-three'] = $new['element-three']; $instance['element-four'] = $new['element-four']; //Return New Instance return $instance; and this works as it is supposed to. But i have a long list of

Custom Page vs Plugin Slug

自闭症网瘾萝莉.ら 提交于 2019-12-06 07:41:44
I'm currently integrating information from a third party API into a wordpress site. What i need to do is create a "dynamic page" where it displays the details of a specific record from the API. Since there are 1000's of records i dont want to create a seperate page in wordpress for every record detail view. I've been looking around and it seems there are two main solutions (i've discarded the custom post type option as i dont think it fits my needs, but im open to re-evaluate). The first is to create a page in the wordpress pages admin, then setup a custom template for that page which calls

Modify Wordpress plugin function in functions.php

牧云@^-^@ 提交于 2019-12-06 04:13:10
I need to change the value of a function from a Wordpress plugin that I'm using. If I do it in the original plugin file, it works perfectly, but I'd rather make it in functions.php to avoid problems on plugin update. I need to change this: public static function loop_shop_per_page() { return get_option( 'posts_per_page' ); } Into this: public static function loop_shop_per_page() { return '-1'; } How would I go to create a filter in functions.php to do just that? Without changing the core plugin code, I don't think you can achieve what you want. Well written plugins usually have apply_filters

Send variable from one page to another in wordpress template

ⅰ亾dé卋堺 提交于 2019-12-06 04:11:19
问题 I am trying to pass date from one wordpress template form to another. To make it simple, I have created two templates (and associated them with WP pages as a standard page) as follows: <?php /* Template Name: Form test */ get_header(); ?> <form action="/form-result/" method="post"> <input type="text" name="name" size="20" /> <input type="submit" value="Go" /> </form> <a href="/form-result/">Result page</a> <?php get_sidebar(); ?> <?php get_footer(); ?> and <?php /* Template Name: Form result

Timthumb can't show image after it's uploaded

陌路散爱 提交于 2019-12-06 02:26:34
问题 I'm using Wordpress plugin called User Avatar, that uses Timthumb for image display. When I open page to show the image, it gives error 500 in the console, and when I use that image link in new tab, I get following error: A TimThumb error has occured The following error(s) occured: Could not create the index.html file - to fix this create an empty file named index.html file in the cache directory. Could not create cache clean timestamp file. Query String : src=http://my.domain.com/wp-content

Simple Regular Expression to return text from Wordpress title - qtranslate plugin

三世轮回 提交于 2019-12-06 02:15:31
I am using qtranslate wordpress plugin to store blog content in multiple languages. Now I need to extract content from qtranslate tags. $post_title = "<!--:en-->English text<!--:--><!--:it-->Italian text<!--:-->"; What would be the php code & regular expression to return text and language from this string? Thanks a lot! Try something like: <?php $post_title = "<!--:en-->English text<!--:--><!--:it-->Italian text<!--:-->"; $regexp = '/<\!--:(\w+?)-->([^<]+?)<\!--:-->/i'; if(preg_match_all($regexp, $post_title, $matches)) { $titles = array(); $count = count($matches[0]); for($i = 0; $i < $count;