Menu
  • HOME
  • TAGS

Wordpress page can't continue due to this error

php,css,wordpress,wordpress-plugin,wordpress-theming

First error is a general server error (look for http 500 status code). It's very unspecific so it you could look up in your server logs fore more information. Second error occurs because the font url can't be reached - try it for you self and open the url of...

Contact Form 7 submit failed validation

php,wordpress,wordpress-plugin,contact-form-7

This is how I managed to get it working. @rnevius answer was failing because the wpcf7_posted_data filter is applied before the data is validated so nothing is invalid at that time. Combining @rnevius' answer with the wpcf7_submit filter and it works as expected. Full code: function send_failed_vaildation_email() { $submission =...

Wordpress Custom Post Type Search

wordpress,wordpress-plugin,wordpress-theming,custom-post-type,wordpress-theme-customize

We've had a lot of success using Relevanssi plugin for altering WordPress's search functionality. You can have WordPress index custom fields, excerpts, and other things, and also add more or less weight to them in your search results. In the excerpt's settings, check the box shown in the screenshot below:...

Previous and Next Button for post on wordpress

css,post,pagination,wordpress-plugin,blogs

You're looking for Pagination. But, bearing Joe Kennedy's comment in mind, here I go: Basically, there are two methods that are used to control pagination, and they are next_posts_link( 'Older posts' ) and previous_posts_link( 'Newer posts' ). They should be placed where your main loop is. (I'm assuming you know...

Better Search box for wordpress

wordpress,search,wordpress-plugin,wordpress-theming

Hi There it work like this using bootstrap modal popup. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <!-- Button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Search </button>...

Wordpress Query by Meta key, type date numeric

php,wordpress,wordpress-plugin

please use 'key' => ('metakey_slug') in place-of 'key' => strtotime('_event_end_date') ...

Trying to show a user's custom post type posts in their buddypress profile?

wordpress,wordpress-plugin,custom-post-type,buddypress,author

You're trying to use $bp without including it as a global. But you don't need it. Try changing 'author' => $bp->displayed_user->id, to 'author' => bp_displayed_user_id(), ...

What's a cleaner way to output HTML from a Wordpress plugin?

php,wordpress,wordpress-plugin,wordpress-plugin-dev

You could just use a single string with concatenations... $form = new \AdamWathan\Form\FormBuilder; $html = $form->open()->action('/apply')->class('bb-loan-form') . '<div class="bb-form-field"> <h2>Loan Application Number</h2>' . $form->text('loan_app_number')->id('loan-app-number') . $form->submit('Continue Loan') . '</div>' . $form->close(); return $html; It at least keeps the HTML aligned. I also don't really see an issue with Heredoc, as...

how to automatically install a wordpress plugin when activating a wordpress theme?

wordpress,wordpress-plugin

you can activate plugin with http://tgmpluginactivation.com/ site after download put inside theme and put this code in function.php below is just example plugin code you can change with your's require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); /** * Register the required plugins for this theme. * *...

how add_submenu_page set for multiple role?

wordpress,wordpress-plugin

I have solved like this.Get the current user role and then add specific admin menu to specific role. `$c_id = get_current_user_id(); $user = new WP_User($c_id); $u_role = $user->roles[0]; if(($u_role == "administrator")) { function register_merchant() { add_submenu_page( $parent_slug, $page_title, $menu_title, 'administrator' , $menu_slug, $function ); } } else if($u_role ==...

remove animation from Nav buttons javascript

javascript,jquery,wordpress-plugin

You need to make few change in you css like, Remove the :hover and :visited:hover from the below properties in lightbox.css /** lightbox.css line 53 */ #stimuli_prevLink { background: url("images/prev.gif") no-repeat scroll left 55% rgba(0, 0, 0, 0); } /** lightbox.css line 54 */ #stimuli_nextLink { background: url("images/next.gif") no-repeat scroll...

Wordpress plugin with classes, namespaces and psr-0 autoloading

php,wordpress,namespaces,wordpress-plugin,psr-0

According to the WP manual in order to use the dbDelta function you first need to include the upgrade file which contains that function. Therefore, adding the following line of code above dbDelta($sql) should fix the problem: require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); ...

Prevent Wordpress settings save - validation

php,wordpress,validation,wordpress-plugin

I think you code will look like: function my_plg_validate_options( $input ) { $old_option = get_option('name_option'); // Your option name if ( ! is_numeric( $input['num_tags'] ) ) { $input['num_tags'] = $old_option['num_tags']; add_settings_error('my_plg_validate_num_tags_field','my_plg_validate_num_tags_error','Incorrect value entered!','error'); } return $input; } Replace name_option with your. Hope that help! Updated: In your case: function my_plg_validate_options(...

Render wp_editor input in theme file using get_post_meta

php,wordpress,wordpress-plugin

When you save the info here: $data = htmlspecialchars($_POST['page_header']); the data is encoded using htmlspecialchars so to render the content as HTML when calling get_post_meta, you will need to decode it: $header = htmlspecialchars_decode(get_post_meta( get_the_ID(), 'page_header', true )); echo $header; ...

How to crop image from center using wp_image_editor

wordpress,image,wordpress-plugin,resize-crop,wp-image-editor

Try this code: $crop = array( 'center', 'center' ); resize( $max_w, $max_h, $crop); ...

How to display page content in custom theme in wordpress?

php,wordpress,wordpress-plugin,wordpress-theming,content-type

You can get the content of any arbitrary page like this: $page = get_page_by_title('About'); I'm grabbing the page by the title, you can also get it by ID or URL path You can then display it by outputting the post_content property of the post object. Note that if you need...

How to move the red marker on a google maps wordpress plugin?

wordpress,wordpress-plugin

You can modify the lat and lng of the marker in javascript code or modify the url if the map is an iframe. Can you post the url of that page for help you?

How to avoid the product's limit for taxonomy in WooCommerce?

php,wordpress,wordpress-plugin,woocommerce,wordpress-plugin-dev

There are two options you could give a try: If you are filtering by category, you are probably using the ["product_category"] where the default per_page attribute is set to be 12. You can override that by specifying the per_page="16". Try to set a priority to your add_filter function in the...

Call to undefined function add_action()

wordpress,plugins,wordpress-plugin

It's a core function and available if your code is activated trough WordPress and accessed trough WordPress. If you try to call your plugin file outside the WordPress scope (for example you approach the file from the browser, directly) then add_action is not available unless you require wp-load.php at the...

Wordpress - How to login user to frontend programmatically

wordpress,wordpress-plugin

The simplest fix is to use wp_login_form() see reference: http://codex.wordpress.org/Function_Reference/wp_login_form If i understand correctly this should handle everything you want. This will set the auth cookie and can redirect to the page you want, the login works globally

Wordpress - how to show links to 'private' pages in wp_nav_menu?

php,wordpress,wordpress-plugin,wordpress-theming

The wp_nav_menu function only walks through the links in the desired menu and it's not fetching them. As can be seen in the source code (line 270) the function that fetch the links get only the name/id/etc. of the menu and not any other arguments. From the manual: Displays a...

locating where wordpress stores plugin information - for purpose of a git repo

wordpress,git,wordpress-plugin,revolution-slider

Plugin state (active/inactive) is in table wp_options, where "option_name" = "active_plugins". Sometimes plugin-specific state variables are also stored in wp_options. Take a look through "/wp-admin/options.php", they are usually prefixed the same way. By the way, one way to figure out where the slider is saving data would be to sqldump...

Add custom functionality on WooCommerce complete button

php,ajax,wordpress,wordpress-plugin,woocommerce

this code will fire as soon a customer made a order and arrives on the thankyou page.. add_action( 'woocommerce_order_status_completed', 'custom_task' ); function custom_task( $order_id ) { // Only continue if have $order_id if ( ! $order_id ) { return; } // Get order $order = wc_get_order( $order_id ); // Do...

woocommerce conditional products/categories on user role

wordpress,wordpress-plugin,woocommerce

To achieve this you can use the Free Groups plugin. But for that you must add all the wholesalers to one group say wholesale group 1. Then while editing any product you get an option to access to, add the wholesaler group 1 there. The product will now be only...

How to redirect a user with specific “ROLE” to a specific page after login in Wordpress [closed]

php,wordpress,wordpress-plugin,wordpress-plugin-dev

Try this : function rohil_login_redirect_based_on_roles($user_login, $user) { if($user->roles[0] === 'student_role'){ exit( wp_redirect('Your page link goes here') ); } } add_action( 'wp_login', 'rohil_login_redirect_based_on_roles', 10, 2); Explanation If you look at the codex, you will find that wp_login provides two parameter: 1) $user_login which will return a string and 2) $user will...

Uniquely identifying a WordPress blog?

php,wordpress,wordpress-plugin

You could create a function to create an unique blog ID, but based on what? URL could change, name could change, theme, server ip and so on. There isn't really an unique and static variable. Create your own one! I use serials and tokens for this. The blog submits a...

WooCommerce - Checking for brand page

php,wordpress,wordpress-plugin,woocommerce

I managed to find a solution to this problem using the is_tax() function that Wordpress provides for using on custom taxonomy archives. Here's my code to check if I'm on a brand page or not. Have tested and appears to be working fine. function is_brand_page_check() { if (is_tax( 'product_brand' ))...

How can I assign a php return value without causing my sql to run twice?

php,mysql,wordpress,wordpress-plugin

First off, in the HTML form, you have onsubmit="return submit_new_client(). The onsubmit attribute is used to call a Javascript function, not a PHP function, so I'm surprised the PHP function is being called at all. Is it possible for you to post the code in its entirety? Edit: I did...

Wordpress - Undefined index on unset field

wordpress-plugin,undefined-index

In your form is no name="kk_youtube[]" or name="kk_youtube[0]" attribute. Use $value['kk_youtube'] instead of $value['kk_youtube'][0] EDIT: $youtube_link = isset($value['kk_youtube']) ? esc_attr($value['kk_youtube']) : ''; ...

How can I put this php into this html?

php,html,wordpress-plugin

Turn it into a function? function foo() { ... your mangled code ... return $whatever_you_built; } $string = "foo bar " . foo() . " baz qux"; ...

Nivo Slider custom height/width problems

html,css,wordpress,wordpress-plugin,nivo-slider

If I understand correctly what you want to achieve is something like this (uncommenting /*overflow: hidden;*/): DEMO HTML: <div> <img src="http://i.imgur.com/cjgKmvp.jpg"/> </div> CSS: div{ position: relative; margin: 100px auto; width: 400px; height: 300px; border: 3px solid red; /*overflow: hidden;*/ } img { position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%)...

How come Page content won't align when creating new page with Visual Composer?

wordpress,wordpress-plugin

Your page has the following markup: <div class="no-container stripe-video-content"> <div class="vc_col-sm-8 wpb_column column_container "> <div class="wpb_wrapper"> <h3 class="headline text-left underline " style="color: #666666"> About Us </h3> <div class="wpb_text_column wpb_content_element "> <div class="wpb_wrapper"> <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa...

Add New Input Field in Wordpress Post Entry

wordpress,wordpress-plugin

you can use custom post field for plugin for this purpose download this Here after that you can fetch the input field with get_post_meta($post->ID,'field name'); ...

add_magic_quotes() is not working in wordpress

php,wordpress,wordpress-plugin,code-snippets,magic-quotes

You don't need to use add_magic_quotes. From the wp_insert_post documentation: This function inserts posts (and pages) in the database. It sanitizes variables, does some checks, fills in missing variables like date/time, etc Emphasis is mine. https://codex.wordpress.org/Function_Reference/wp_insert_post add_magic_quotes essentially iterates over an array and calls add_slashes on each element. This is...

Syntax error when moving Wordpress Site

php,sql,wordpress,wordpress-plugin,syntax-error

You cant just move a wordpress site by copy and pasting. Also exporting and importing Database will cause errors like this. Use all in one migration plugin. First install a wordpress site in your live server then export a backup from your dev server with the plugin and import same...

How to insert text on post link Wordpress?

wordpress,.htaccess,wordpress-plugin

In the permalink page (Settings > Permalinks), select the last option to enter a custom permalink structure and enter this : /blog/%postname%/ It will prepend all your post urls with /blog/. UPDATE To prefix posts only, use the following function in your functions.php : function add_rewrite_rules( $wp_rewrite ) { $new_rules...

Buddypress: Language not changing

wordpress,wordpress-plugin,buddypress

You need to create and upload the buddypress-es_ES.mo file. The .po files are used to create the .mo file. You don't need to upload the .po files.

Can't use field name for have_rows() on WordPress ACF repeater fields

php,wordpress,wordpress-plugin,advanced-custom-fields

My issue was with caching specifically memcached. Once I configured that correctly this issue stopped happening.

Prevent theme styles from loading in custom page template

wordpress,wordpress-plugin

I did some digging in Google and came up with something that does what I want. After clearing I can add my own styles and scripts. function clear_styles_and_scripts() { global $wp_scripts; global $wp_styles; foreach( $wp_scripts->queue as $handle ) : wp_dequeue_script( $handle ); wp_deregister_script( $handle ); endforeach; foreach( $wp_styles ->queue as...

How to add image dimensions in an image being added via regex

php,html,regex,wordpress-plugin

If none of them has dimensions set, You can simply add width="1" height="1" to img tag. Like this: $content = preg_replace( '#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*?)(\/)?>#', sprintf( '<img${1}src="%s" data-lazy-src="${2}"${3} width="1" height="1" /><noscript><img${1}src="${2}"${3}></noscript>', $placeholder_image ), $content ); If added at the end of <img> tag it should't interfer even when oryginal image would have it...

How to display Posts in wordpress page using mysql query?

php,mysql,wordpress,wordpress-plugin

There are a few problems with your code. Firstly, you're not passing your DB connection parameter to the query. $res=mysqli_query($sqli) ^ missing the 1st parameter. Modify it to read as: $res=mysqli_query($con, $sqli) and mysqli_error() requires DB connection be passed as a parameter mysqli_error($con) References: http://php.net/manual/en/mysqli.query.php http://php.net/manual/en/mysqli.error.php However, WordPress has its...

Facebook ignoring OG image on first share

facebook,wordpress-plugin

You can avoid this by either getting your content “pre-scraped” by triggering a scrape via API as soon as you publish it, or by specifying the image dimensions via OG meta tags as well. https://developers.facebook.com/docs/sharing/best-practices#precaching: When content is shared for the first time, the Facebook crawler will scrape and cache...

Woocommerce : Replace ' Product Categories ' by ' Short Description ' on Product Page

wordpress,wordpress-plugin,woocommerce,product

Generally in WooCommerce, It is located in wp-content > plugins > woocommerce > templates > single-product > meta.php Line 30 But if you are using themes for woocommerce, then it might be located at some other place but for that you need to debug by your self to find it....

jQuery ajax call works only if its debugged step by step

php,jquery,ajax,wordpress,wordpress-plugin

Basically add event.preventDefault();after ajax call Something like this, $('.single_add_to_cart_button').click(function(event) { $.ajax({ type: "POST", url: script_e.ajaxurl, //url loaded from the plugin data: {id:test}, cache: false, success: function(data){ alert(data); } }); event.preventDefault(); }); ...

Stop form submission on photo uploding (userpro plugin)

wordpress,wordpress-plugin

Yes It fire just because of below code which I found in script.min.js file. below code fire trigger any input. form.find('input').each(function(){ jQuery(this).trigger('blur'); }); just remove above code from that file and problem is solved....

Wordpress Registration Plugin with payment option [closed]

wordpress,wordpress-plugin

Check out Plugin: https://wordpress.org/plugins/paid-memberships-pro/ You may find it useful for your requirement...

WordPress Widget creation helper

wordpress,wordpress-plugin,wordpress-theming

Here is a good starting point WordPress Widget Boilerplate, its updated often by a core contributor. This one here is somewhat more recent and has a web interface but based on the initial build by Tom McFarlin. Also here is a barebones version which is slightly improved from the one...

Undefined variable in a class when I have defined it

php,wordpress,wordpress-plugin,wordpress-theming,wordpress-plugin-dev

Like others have said, you need to be using $this->person because of the scope. Variables inside of functions only live inside those functions unless they are passed in and returned or passed in as a reference. To address your comment on the OP, you don't need to instantiate it in...

We need to output this as a static site to be hosted on the clients servers [closed]

php,wordpress,wordpress-plugin,wordpress-theming,wordpress-mu

The StaticPress plugin can generate the static site to a different folder which could then be uploaded to the remote server. Depending on what kind of access is available on the remote server, some sort of automatic sync should also be possible.

jQuery while loop stopping prematurely

jquery,while-loop,wordpress-plugin

All right, problem solved. Some sort of bizarre loading order issue. Fixed it with jQuery(window).load() rather than just blindly running when enqued. Sorry for the trouble.

Do I have to be admin to make requests to wp-admin/admin-post.php?

php,wordpress,wordpress-plugin

Make sure you are using admin_post_nopriv_* as your post action? Because that is what you need to do to post as an unauthenticated user. I.e: add_action('admin_post_nopriv_loan_app_form', function() { […] As a secondary solution, consider using XML-RPC WordPress API to post data if possible....

Add an hint field in the admin page of a plugin

wordpress,wordpress-plugin

I'm not sure how much code you've written so, short story, simply put the text in a p tag with class="description" to get the formatting you're looking for. But it seems like you might still be constructing the code for you options page and so I'm including the following code...

Passing variables from PHP to Javascript with wp_localize_script function

ajax,wordpress,wordpress-plugin

The issue is that $someone is not within the scope of your function. You can import it into the scope, by declaring it as global and then accessing it: global $someone; $someone = 'whatever'; function admin_script_style($hook) { global $someone; // $someone is now accessible ... } Note that, you don't...

Change upload_dir folder at a certain cpt but cant change back

wordpress,upload,wordpress-plugin,wordpress-plugin-dev,custom-post-type

I found! this will only change the upload dir when upload in the "rsg_download" CPT add_filter( 'wp_handle_upload_prefilter', 'rsg_pre_upload' ); function rsg_pre_upload( $file ) { add_filter( 'upload_dir', 'rsg_custom_upload_dir' ); return $file; } function rsg_custom_upload_dir( $param ) { $id = $_REQUEST['post_id']; $parent = get_post( $id )->post_parent; if( "rsg_download" == get_post_type( $id )...

How to hook into Contact Form 7 Before Send

wordpress,wordpress-plugin,contact-form-7

I had to do this to prevent Email from being sent. Hope it helps. /* Prevent the email sending step for specific form */ add_action("wpcf7_before_send_mail", "wpcf7_do_something_else"); function wpcf7_do_something_else($cf7) { // get the contact form object $wpcf = WPCF7_ContactForm::get_current(); // if you wanna check the ID of the Form $wpcf->id if...

Insert a row when create a user in wordpress

insert,wordpress-plugin,user-registration

You can debug your data using wp_die() and can debug data is getting or not

In woocommerce how to add Participant List on checkout page and show in order detail page

wordpress,wordpress-plugin,woocommerce,wordpress-theming,wordpress-loop

To add field after order notes field in checkout page. add below code in function.php to get below screen. Here we show total item in cart -1 rows. Because 1 participant is that make order. add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); function my_custom_checkout_field( $checkout ) { global $woocommerce; $class_basket_count = $woocommerce->cart->cart_contents_count; $class_basket_count...

How can I make content disappear when a user logs in?

php,css,wordpress,login,wordpress-plugin

You have to edit the plugin code and also understand the how the plugin works but you do it in another way a quite tricky but it works. add_filter('wp_head','my_js_code'); function my_js_code() { if (is_user_logged_in()) { ?> <script type="text/javascript"> var $j = jQuery.noConflict(); $j(".sfsi_widget").remove(); </script> <?php } } Write this code...

What does internally hosted means

php,wordpress,wordpress-plugin,wordpress-theming,wordpress-plugin-dev

internally hosted means that you have your system running inside the company infrastructure. So it means that your client want to have wordpress installed on a server managed by the company.

How can I imitate this modal effect in a Wordpress site?

jquery,wordpress,wordpress-plugin

This should be relatively simple to achieve using jQuery show/hide. http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_show Apply show when someone clicks the email icon and hide when someone clicks close. It's then just a case of using CSS and position:fixed; for the div. ...

Wordpress - next_post_link() not filtering by post_type showing nothing

php,wordpress,wordpress-plugin,wordpress-theming

I managed to solve it by doing the following, Performing a WordPress query getting all of the relevant posts for the post type 'portfolio' Declare an array of IDS and put each post ID inside. Get the index from the array of the current post Check the page exists, if...

How to Get Current Custom Post Type Associated Taxonomy Term

wordpress,wordpress-plugin,wordpress-theming

You can use get_the_term_list within your loop to get the associated taxonomy term links: global $post $terms = get_the_term_list($post->ID, 'your_taxonomy'); echo $terms; This was a good solution for me as I only ever had a single taxonomy term associated to each post....

Bootstrap is overriding my submit button on the form on my website

css,wordpress,forms,twitter-bootstrap,wordpress-plugin

It is because you are not using col-xs- for small devices. For example: <div class="col-md-4 col-xs-12"> <div class="product-text"> ... </div> </div> should sort your problem....

Wordpress Pre Fill content in Posts

php,wordpress,wordpress-plugin,wordpress-plugin-dev

This is what I ended up doing : in jQuery : function add_to_post(feed_id) { var title = $(document.getElementById('title_'+feed_id)).text(); var content = $(document.getElementById('summary_'+feed_id)).text(); var link = host+"/wp-admin/post-new.php"; var data = { 'post_title' : title, 'pre_content' : content, 'post_type' : 'post' }; $.extend({ redirectPost: function(location, args) { var form = ''; $.each(...

Youtube Channel Gallery getting no longer supported video from YouTube

wordpress,youtube,wordpress-plugin

I would recommend taking a read through this thread in the support forum for the plugin: https://wordpress.org/support/topic/getting-no-longer-supported-video-from-youtube There are some different solutions, depending on whether you are using the widget or shortcode, but a few different approaches came up depending on what is easiest for you - personally, I favor...

Yoast SEO multilanguage site

wordpress,wordpress-plugin,seo,multilanguage

The following two plugins will do what you need https://wordpress.org/support/plugin/qtranslate-x https://wordpress.org/plugins/wp-seo-qtranslate-x BWS is not supported in any way by Yoast...

Wordpress - Attach uploaded image to post

php,wordpress,image,post,wordpress-plugin

Didn't try it. But maybe you could use this. Got it from the codex in combination with the get_attached_file function // the ID of the attachment $filename = get_attached_file( $attachment_id ); // Full path // The ID of the post this attachment is for. $parent_post_id = 37; // Check the...

Add shortcode inside another with echo

wordpress,wordpress-plugin,shortcode

There's not enough information in your code sample to say for sure. However, it looks like you are attempting to put PHP code into an actual WordPress page/post. Is that the case? If not, please provide more info on what you're trying to do exactly. If so, you can't put...

need wordpress plugin to show 3 type of different kind of text, image and 2 buttons

wordpress,plugins,wordpress-plugin

Your question is not really understandable, but I think you are looking for this, it's a really good slider with a lot of functionality. Revolution Slider...

How to call a function on click

javascript,php,jquery,plugins,wordpress-plugin

"I have a function from a plugin that I need to reinitialize on click" Everything will depend on what you want this function to do. Do you want it to produce some output to show on your page? Do you want it to just run a server side script? Both...

Overriding plugin functions from a theme

wordpress,wordpress-plugin,wordpress-theming

The easiest way to do this would be to use a Must Use Plugin. Create a folder called /wp-content/mu-plugins. Any PHP file in this directory will be loaded (they do not have to be activated) and will be executed before the activated plugins or your theme files (including functions.php). Use...

How to change custom admin menu?

wordpress,function,wordpress-plugin,wordpress-theming,wordpress-plugin-dev

can you plz try this code. <?php function edit_admin_menus() { global $menu, $submenu; $menu[24][0] = 'My Plugin'; // TO change admin parent menu $submenu['mylist'][0][0] = 'All Posts'; // To change child menu of "My Plugin" parent } add_action( 'admin_menu', 'edit_admin_menus' ); ?> Thanks....

How to add additional settings on error in Contact form 7?

jquery,wordpress-plugin,contact-form-7

In version 3.3 new jQuery custom event triggers were introduced: New: Introduce 5 new jQuery custom event triggers (invalid.wpcf7, spam.wpcf7, mailsent.wpcf7, mailfailed.wpcf7, submit.wpcf7). See: http://contactform7.com/2012/09/24/contact-form-7-33/#more-2598 You can use invalid.wpcf7 like the example below: $(".wpcf7").on('invalid.wpcf7',function(e){ // Launch your modal window here }); ...

How do I disable or hide a survey for my WP users once it has been submitted?

php,wordpress,wordpress-plugin

You can add a user meta when he completes the survey: if( user_completed_survey() ) add_user_meta( get_current_user_id(), 'survey-done', 1); And check it everytime: if(is_user_logged_in() && !get_user_meta( get_current_user_id(), 'survey-done', true )) { // show survey } ...

How to set woocommerce checkout form values to empty

wordpress,wordpress-plugin,woocommerce

Not sure with your exact issue , but there might be two possible situations in your case. You might me logged in with same user and then trying to checkout, as woo-commerce will fetch the details of currently active user and auto fill it during checkout. Fields might get auto...

JSON API for Wordpress returns clutter

objective-c,json,wordpress-plugin,json-api

The clutter you are getting is part of the JSON, there is no problem. It is part of the "content" item. In particular the contents of: dataDictionary[@"posts"][0][@"content"]. It is the HTML content of a post. If there are portions of the content that you don't want you will have to...

Custom page / message after installation of wordpress plugins

wordpress,wordpress-plugin,wordpress-plugin-dev

The register_activation_hook function registers a plugin function to be run when the plugin is activated. register_activation_hook(__FILE__, 'redirect_to_instruction_page'); function redirect_to_instruction_page(){ wp_redirect( admin_url( 'admin.php?page=instructions' ) ); exit; } ...

How to show post formats in custom post types?

php,wordpress,wordpress-plugin,custom-post-type

'post-formats' need to add in 'support'..may be halpful 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'post-formats') ...

Display Popup when text is clicked in wordpress

wordpress,text,popup,wordpress-plugin

Hi you can used bootstrap modal popup. as like demo <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <!-- Button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal...

Authentication Issue with WP-API and Net::Http

ruby,wordpress,oauth,wordpress-plugin,net-http

I simply install this basic_auth plugin in my Wordpress site. First, I download the zip file from this link Now extract it to /content/plugins folder in your project directory Activate this plugin from your wp-admin interface. Now I use the following code snippet for authentication uri = URI.parse("http://vagrant.local/wp-json/wp/v2/posts") http =...

How to get JSON id after item is created

php,json,wordpress,wordpress-plugin

It's called array index. Assuming $collections is zero based numerical array without any "holes" in it (hole would be eg index 1 in [0 => 'a', 2 => 'b']), you can use: $collections[] = array('label' => $name); $idx = count($collections) - 1; If it's not numerical or there can be...

Update a post without update post title

wordpress,wordpress-plugin,hook,posts

Use this function : add_action('post_updated','after_update_post_without_update_title',10,3); function after_update_post_without_update_title($postId,$after,$before) { global $wpdb; $where = array( 'ID' => $postId ); $oldTitle = $before->post_title; $data = array('post_title'=>$oldTitle); $wpdb->update( $wpdb->posts, $data, $where ); return true; } ...

Wordpress custom post action hook

php,wordpress,wordpress-plugin,wordpress-plugin-dev,custom-post-type

Not sure if there is just one action but here are the various actions: save_post (create or update) wp_delete_post (deleted) wp_trash_post (trashed) so you can do something like this: function my_callback_function() { if($post->post_type = 'job') { //do something here } } all_actions = array('save_post','wp_delete_post','wp_trash_post'); foreach ($all_actions as $current_action) { add_action($current_action,...

disable update for wordpress plugin named Dropbox Folder Share

wordpress,plugins,wordpress-plugin,wordpress-plugin-dev

The nicest way to do it would be to hook into 'site_transient_update_plugins'. function so_filter_plugin_updates( $value ) { unset( $value->response['dropbox-folder-share/dropbox-folder-share.php'] ); return $value; } add_filter( 'site_transient_update_plugins', 'so_filter_plugin_updates' ); A hacky way to do it would be to change the version number in the plugin to something ridiculously high, like 9999.999....

Custom WooCommerce Gateway

wordpress,wordpress-plugin,woocommerce

oh, its because you forgot to set the has_fields flag to true. //after setting the id and method_title, set the has_fields to true $this -> id = 'kiwipay'; $this -> method_title = 'KiwiPay'; $this->has_fields = true; // if you want credit card payment fields to show on the users checkout...

How can I wrap this text so it doesn't overflow past the widget container?

html,css,wordpress,wordpress-plugin,wordpress-widget

in css do this to wrap text in elipsis mode (three dots) .overflow-hidden{ max-width:400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } ...

To grep version number from Wordpress plugin folder

regex,wordpress,grep,wordpress-plugin

grep -rPo "(^|\s|^\*)+(Version\s*:\s*)\K([0-9]|\.)*(?=\s|$)" /home/test/public_html/wp-content/plugins/attachments/ Explanation : -P stands for PCRE, -o for taking only the matched portion of the line (^|\s)+(Version: ) will match Version at the start or one or more whitespaces, the \K will then discard the match ([0-9]|\.)* will match any digit or . zero or more...

How use theme's function into plugin's file in Wordpress

wordpress,wordpress-plugin,wordpress-theming

Plugins are loaded before the theme so the function hasn't been defined at the time you're calling it. Execute your code on a hook such as init instead. E.g. function wpse_my_plugin_init() { myPreviouslyUndefinedThemeFunction(); } add_action( 'init', 'wpse_my_plugin_init' ); See here for a list of hook options: https://codex.wordpress.org/Plugin_API/Action_Reference The earliest opportunity...

Woocommerce tax calculation with cart custom fees

wordpress-plugin,woocommerce

Update: Ah silly me, it turns out there is tax argument for add_fee function Woocommerce WC_Cart documentation So the full working code is function woo_add_cart_fee() { global $woocommerce; $admin_fees = get_option( 'admin_fees', 10 ); $stamp_duty = get_option( 'stamp_duty', 10 ); $refundable_deposit = get_option( 'refundable_deposit', 10 ); $woocommerce->cart->add_fee( __('Admin Fees', 'woocommerce'),...

Breadcrumb menu in wordpress

wordpress,menu,wordpress-plugin,breadcrumbs

You can add breadcrumb without using any plugin like this. Please add below code into your themes functions.php file. function breadcrumbs($id = null){ ?> <div id="breadcrumbs"> <a href="<?php bloginfo('url'); ?>">Home</a></span> > <?php if(!empty($id)): ?> <a href="<?php echo get_permalink( $id ); ?>" ><?php echo get_the_title( $id ); ?></a> > <?php endif;...

Wordpress Add my plugin admin menu to my admin new role

wordpress,wordpress-plugin,wordpress-plugin-dev

Add capability for you new role and use this capability in add_menu_page. you can use this referral link...

Unable to add bullets before post title on WP

php,css,wordpress,wordpress-plugin

If the post headings are in a list format (like in a navigation list) go with the list-style method. But if the post headings are actual heading elements, go with the CSS :before method. List-Styles You can style your ul elements with the list-style CSS property. Resource CSS-Tricks: list-style Example...

Composer custom installer paths with WPackagist

php,wordpress,wordpress-plugin,composer-php,packagist

The problem is you have two keys with the same name so the second is overwriting the first. Try this instead: "extra": { "installer-paths": { "vendor/{$name}/": ["type:wordpress-plugin", "type:wordpress-theme"] } } ...

formidable:- Hide short code closing bracket on page

wordpress,wordpress-plugin,formidable

As i search from the web but didn't got the way so i have used my way added one div before of ] closing bracket of short code and settled div style property visibility:hidden; like a bellow snippet code. I don't know how much is right or wrong but it...

Usermeta in wordpress plugin won't save - development

wordpress,wordpress-plugin,wordpress-plugin-dev

I tried your code and value is saved correctly. Only one problem is there while displaying saved value. $user parameter needs to be passed in the function add_adslot_text. Eg: function add_adslot_text( $user )...