wordpress-plugin

remove published post notice while error handled

孤街浪徒 提交于 2020-01-13 06:17:09
问题 im creating an error handler for a custom post type. add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 ); function filter_post_data( $data , $postarr ) { //error handling if($data['post_type'] == 'post_annunci') { if($postarr['annuncio_prezzo'] == '' || !is_numeric($postarr['annuncio_prezzo'])) { $errors .= 'Annuncio non salvato, devi inserire un prezzo con valori numerici.</br>prezzo = '.$postarr['annuncio_prezzo']; update_option('my_admin_errors', $errors); $data['post_status

Wordpress - Removing default styles

本小妞迷上赌 提交于 2020-01-11 06:54:07
问题 I'm trying to create my own Wordpress theme just for a one page, secured form. This form looks as it should normally, as you can see in this screenshot --> Unfortunately, even though I've included my own reset.css file, WordPress is inheriting styles from the theme's style.css file. See here --> As you can see, the font size is much smaller, input fields aren't getting proper padding, the body background is supposed to be blue but is a grayish color in the second screenshot, fields aren't

How do do_action and add_action work?

↘锁芯ラ 提交于 2020-01-09 19:47:39
问题 I am trying to find what exactly do_action and add_action works. I already examine with add_action but for do_action i am trying as new now. This what i tried. function mainplugin_test() { $regularprice = 50; if(class_exists('rs_dynamic')) { $regularprice = 100; } // and doing further //like i echoing the regular price echo $regularprice; //It print 100 from this code } Now instead of placing few code in main file i am planning to create do_action to avoid code messing issue. function

how to remove “Archive | ” from wordpress?

Deadly 提交于 2020-01-07 09:51:47
问题 how do you remove "Archive | " from wordpress category page and only show the category? is there a plugin or what code do i need to remove? Thank you in advance ;-) 回答1: What I imagine that you mean is that there is a header tag containing "Archive | " somewhere in your category page. If you want to get rid of this string, the first thing you should look for is whether or not this can be changed somewhere in a Theme Options Page (if applicable). If you don't have a Theme Options Page, look

how set the scope for the AJAX query with buddy press meta query

自作多情 提交于 2020-01-06 15:18:17
问题 I am trying to filter group with meta query with reference of bellow reference link code https://gist.github.com/boonebgorges/2638943 This link code i have added in my function.php and bellow code of spinet i have added in /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/groups/index.php in div groups dir-list $meta_filter = new BP_Groups_Meta_Filter( 'group-custom-field-cat', 'Art and Culture' ); //print_r($meta_filter); echo @json_decode($meta_filter, true); Now if you visit

is_user_logged_in() not working in wordpress plugin

元气小坏坏 提交于 2020-01-06 13:11:02
问题 is_user_logged_in() function not working in wordpress plugin Show warning like below: Fatal error: Call to undefined function is_user_logged_in() in How can I use the logic in wordpress plugin? 回答1: is_user_logged_in() is located in wp-includes/pluggable.php . So please include this file in your plugin file and check. 回答2: Plugins are loaded prior to pluggable.php , which is where is_user_logged_in() is located. Which means the function doesn't exist yet when you're trying to call it. Instead

is_user_logged_in() not working in wordpress plugin

旧时模样 提交于 2020-01-06 13:09:12
问题 is_user_logged_in() function not working in wordpress plugin Show warning like below: Fatal error: Call to undefined function is_user_logged_in() in How can I use the logic in wordpress plugin? 回答1: is_user_logged_in() is located in wp-includes/pluggable.php . So please include this file in your plugin file and check. 回答2: Plugins are loaded prior to pluggable.php , which is where is_user_logged_in() is located. Which means the function doesn't exist yet when you're trying to call it. Instead

How to use the_permalink() on wordpress when it's wrapped with ' or "

邮差的信 提交于 2020-01-06 04:20:08
问题 I have a code that wraps every image on posts with an external div (for share buttons when hovering on images). The thing is, when I want to write the_permalink(); in the function.php, it's wrapped inside a ' or a " in the a href tags. That causes share links look like this: https://plus.google.com/share?url=%3C?php%20the_permalink();%20?%3E This is the code in function.php: function breezer_addDivToImage( $content ) { // A regular expression of what to look for. $pattern = '/(<img([^>]*)>)/i

WooCommerce: Only 1 product in cart. Replace if one is added

别来无恙 提交于 2020-01-06 03:02:46
问题 I am fairly new to WooCommerce so I dont know what could be of use to answer my question, this is why I have not added any codeblocks. I would like to let customers only add one product to the cart and if they add another product the current product in cart is replaced by the last one. Do I need to make changes in the code or is it possible with a plugin or WooCommerce setting? I am looking forward to helpful replies. Thanks 回答1: /** * When an item is added to the cart, remove other products

create wordpress plugin with zend framework 2

浪尽此生 提交于 2020-01-04 07:00:31
问题 I want to develop a membership plugin under wordpress and for this I want to use zend framework 2. Does anyone managed to create a wordpress plugin using zend framework 2? I'm new to zf and I do not know how and where to start from. I tried to start from zend skeleton application but got stuck at add_menu_pages and displaying a simple dashboard. Can anyone give me some ideas or links. Thanks! Updated ! I managed to get this working! I just needed to use a PhpRenderer. For those who need a