wordpress-plugin

wp_footer hook puts content below footer

本秂侑毒 提交于 2019-12-12 06:19:16
问题 My custom plugin to put a red sign-up bar just above the footer is putting it at the bottom of the footer using wp_footer. If I use the the_content in a filter, then it puts it into the description of the Woo Commerce product pages. Does anyone know of a way to move this action from the bottom to the top of the footer inside of the plugin? I have tried many combinations of things and am just getting no where. Thank you for helping. Signup Bar Plugin <?php /* Plugin Name: ccg-signup

how to pass parameter in wordpress plugin

落爺英雄遲暮 提交于 2019-12-12 06:06:57
问题 I am trying to pass argument in function and print the output in wordpress plugin i was not able to pass parameter here's my code global $postidd; $postidd=$_REQUEST["postid"]; function getcontent($postidd) { // do something with the args if($postidd) { $args12 = array( 'p'=>15, 'post_type' => 'offers', 'orderby' => 'title', 'order' => 'ASC' ); $the_query12 = new WP_Query( $args12 ); if ( $the_query12->have_posts() ) : while ( $the_query12->have_posts() ) : $the_query12->the_post(); return

How to manually add Shadowbox.setup() to the footer of your theme?

余生长醉 提交于 2019-12-12 05:38:18
问题 I have a Wordpress website with two versions, one full-sized and one for mobile browsers. I want to shut down the Shadowbox.JS plugin for the mobile theme. (I want images to be opened directly) I've found something in the Advanced settings of the plugin. Skip setup: true/false. Set this true to skip Shadowbox.setup() during Shadowbox.init(). For purposes of this plugin you will have to manually add Shadowbox.setup() to the footer of your theme. Defaults to false. How do I manually add

How to Add Jquery FullCalendar in wp plugin in admin

自古美人都是妖i 提交于 2019-12-12 04:59:52
问题 I m developing a plugin in my plugin file i have registers these files. function add_fullcaledar(){ wp_enqueue_style( 'ui-css', plugins_url( '/css/jquery-ui.min.css', __FILE__ ) ); wp_enqueue_style( 'full-css', plugins_url( '/css/fullcalendar.css', __FILE__ ) ); wp_register_script( 'moment-js', plugins_url( '/js/moment.min.js', __FILE__ ) ); wp_register_script( 'full-js', plugins_url( '/js/fullcalendar.min.js', __FILE__ ) ); wp_enqueue_script('moment-js'); wp_enqueue_script('full-js'); } add

Wordpress admin widget that exports data

放肆的年华 提交于 2019-12-12 04:59:36
问题 I've been coding in PHP for a long time, but I'm currently writing my first Wordpress plugin. The plugin's goals are: Display a form on a public-facing page to collect simple data from site visitors (first/last name, etc) Provide a way for admins export the data I've got a plugin that successfully creates a table on activation and a shortcode that provides a form which successfully stores the submitted data in the database. On the back-end, I have a dashboard widget that currently displays

Edit .htaccess on plugin deactivate

六眼飞鱼酱① 提交于 2019-12-12 04:37:07
问题 I am trying to add rewrite rules in .htaccess during plugin activation. How can I edit/roll-back rewrite rules in .htaccess on plugin deactivation? function add_to_htaccess( $rules ) { $content = <<<EOD \nAddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE

Wordpress widget/plugin - content based on text of post(s)/page(s) visible?

為{幸葍}努か 提交于 2019-12-12 03:43:37
问题 I'm new to the Wordpress plugin and widget APIs, but I'm sure this is possible. I'd like to make a plugin or widget that would create links to other posts or external sites based on certain keywords/tags in the content of the given page/post. Is this possible? For example, if a term is in all-caps, link to the Wiktionary definition; inside a <news>..</news> pair, go to Google's news search; etc. 回答1: This is definitely possible. Don't bother looking into the widget api for this. Look at the

I can not paginate my plugin

独自空忆成欢 提交于 2019-12-12 03:35:28
问题 I have a code of a plugin I made, which shows a custom table and I need to add paging. This code does appear pagination and results, but does not work when clicking on the following pages (1, 2, 3 ... etc) but shows the same. This is my code: $per_page = 3; $page = intval(get_query_var('page')); // cast to int to be on the safe side $total_pages = ceil($wpdb->get_var("SELECT COUNT(*) FROM wp_puntos_log") / $per_page); //use $wpdb->prepare to help against sql injection $sql = $wpdb->prepare(

Save user generated options in wp-plugin

半城伤御伤魂 提交于 2019-12-12 03:34:27
问题 I want to create a slogan plugin for wordpress with an easy user interface. it shall randomly display a user-defined slogan along with a name who said it. In the plugin options I want to enable a user to dynamically add or delete those slogans. Here's a quick mock-up of what I want in the end so you can understand it better: There's the "Add Slogan" button which adds 2 new input fields along with the delete this slogan button. So if there was only Name1 and you press the button, those fields

How to modify WordPress REST API response

走远了吗. 提交于 2019-12-12 03:07:59
问题 I am really really new to WordPress and I just I installed the REST API. I am not satisfied with the default response and I want to modify it to fit the purpose I'm using it for. I prefer the way this link modified it's response. Particularly, the "author" object details were returned in the response. In this other blog , REST API is returning the default response. Here, "author" is an array in "_links" object. And it doesn't even contain the details of the author, just a link to it. My