Tag Info

New answers tagged

0

You need to hook into that action, not repeat it. I believe you want something like this. The function will fire with the validate_password_reset add_action( 'validate_password_reset', 'my_passwd_function', 10, 2 ); function my_passwd_function() { echo 'Your Code Here'; return; }


0

You can add button via add_meta_box function. function add_your_meta_box(){ add_meta_box('your-metabox-id', 'Title', 'function_of_metabox', 'custom_post_type', 'side', 'high');} add_action('add_meta_boxes', 'add_your_meta_box'); function function_of_metabox() {?> <input type="submit" class="button button-primary button-large" value="Add New" ...


2

Like this: function custom_js_to_head() { ?> <script> jQuery(function(){ jQuery("body.post-type-YOUR-CUSTOM-POST-TYPE .wrap h1").append('<a href="index.php?param=your-action" class="page-title-action">Import from ...</a>'); }); </script> <?php } add_action('admin_head', 'custom_js_to_head'); ...


1

The only 100% way to get a paid subscription kind of service working is to move part of the functionality to an external server which is under your control and manage payment, expiry, etc there. When the code is not under your control you can not limit its use, this is a very basic life fact of software development, especially when the source code can be ...


1

Fatal error: Cannot redeclare append() is very simple to fix: Your plugin seems to have a function called append(), right? On the wordpress install with this error there is another plugin which has a function append() too. You can fix this using PHP Namespaces or just give your function a more unique name like pluginname_append().


1

I learned from the comments by @Pieter Goosen and @Ignat.B, and @Pieter Goosen's answer here, that I need to register the taxonomy on plugin activation, and insert the term. Then I need to hook the taxonomy registration code to the init action hook as suggested by the codex. This will ensure that when I insert the term on plugin activation, I have the ...


1

If you dont want 'TopLevel' menu to represent a custom page you can use: add_menu_page( 'TopLevel', 'TopLevel', 'MENU_CAP_LVL', 'MENU_SLUG', 'MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu', 'SubMenu', 'MENU_CAP_LVL', 'SUB_MENU_SLUG', 'SUB_MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu-A', 'SubMenu-A', 'MENU_CAP_LVL', 'SUB_MENU_A_SLUG', ...


-1

You can easily handle via css. Like .class_name{ display:none; } Hopefully it will work for you.


0

If someone else stumbles upon this thread, the problem was likely caused by using the PHP short open tag feature (<? ?> vs. <?php ?>), whereas the short_open_tag directive was disabled on the server.


0

Here's an alternate approach of filtering the posts after the query using whether the wp_get_attachment_thumb_url() returns an empty string to determine if the post has a thumbnail (featured image). //get all the posts however your query does it. simple example when there aren't a lot: $args = array("nopaging" => true); $posts = (new ...


1

Use php dot notation. Try: $my_templates = get_stylesheet_directory() . '/lp/'; $base = array( trailingslashit(get_template_directory()), $my_templates );


1

Textdomain Error The error message mean, that you haven't a textdomain. There is required for translation of this string. In the first error message is the problem the missing textdomain on the function _n_noop(). Right usage as example below. _n_noop( 'Security Release', 'Security Releases', 'your_textdomain' ); Text Domain Information about the ...


1

The earliest safe hook to get post information is the template_redirect hook. All the hooks in question runs before Wordpress has setup postdata, so any post info are still unavailable at that point. The globals like $wp_query and $post will still contain no data, that is why your efforts returns nothing. EDIT Extra info as per comment by @TheDeadMedic ...


0

If your plugin is not in the official wp plugin repository, than add a small function in your plugin, that exclude it from the update routine. It is not helpful that WordPress search for a update or this plugin. The source below helps you. Include it in your plugin to deactivate the update check for your custom plugin, in topic performance and redundancy ...


0

You've already been pointed to the correct approach and the answer is functionally identical to any of the answers here about appending data to post content. All you need is something like: function my_function () { echo 'my function content'; } add_action('the_content','my_function'); To restrict that to single post pages: function my_function () { ...


0

Do you need the "View Details" link? It shouldn't show up unless it's a WP hosted plugin. Could you just name the plugin whatever you want, but change it with JS in the admin function my_enqueue($hook) { if ( 'plugins.php' != $hook ) { return; } wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'changeName.js', array( 'jquery' ), '1', ...


2

register_activation_hook is one-time only activation hook. It can be used for database structure creation, as example, that needs to fire only on plugin activation trigger. In order to set a custom taxonomy you need a hook that will fire not just once, but per every WordPress load. Such as init. Use add_action( 'init', 'YOUR_CALLBACK' ); to achieve that


0

I don't think we can do that as a page in Wordpress, but I have another idea.. You can add a new taxonomy for your posttype template, like categories, then create a custom field for your posttype, (do the metabox) to show templates.


1

Plugins that load the WordPress environment this way get rejected from the repository, as they are prone to failure in non-standard configurations. For something like this I would use the admin-post-$action to receive requests. The WordPress API will be available where you can check if users are authorized to perform specific actions.


0

The code you are seeking for is located in the wp-admin/includes/class-wp-upgrader.php. There is a bunch of classes regarding all updates.


0

I managed to find a solution: File 1: //Count the number of active plugins whose Author is "My Brand", and store the number in a global variable. $GLOBALS['mybrand_active_plugins']=0; if (!function_exists('get_plugins')){require_once ABSPATH.'wp-admin/includes/plugin.php';} $plugins=get_plugins(); ...


1

If you don't need to store very large data you should take a look to the Wordpress Transient API: http://codex.wordpress.org/Transients_API Your data will be handled by Wordpress with an expiration time. I think it is the more "wordpress-way" to cache data.


1

The WP function get_attached_media() should provide the info you need. If used in this way... $media = get_attached_media( 'image' ); ... the $media var should contain the wp_post objects for all attached images. Function documentation in the WP Codex: https://codex.wordpress.org/Function_Reference/get_attached_media


0

This could be the answer: http://codepen.io/flesler/pen/AEIFc Just adding the following CSS will make it work like a placeholder: [contenteditable=true]:empty:before { content: attr(placeholder); display: block; /* For Firefox */ } We just need to find a way to add a data-attribute to the contenteditable element in the tinyMCE and also add the ...


1

I would not try to get too tricky and hide pages from users. What happens if they try to create a page with the same slug? I think it would just create confusion and more problems than it would solve. When you create the pages, store their IDs, not slug. Let users then change those through your options screen. This is similar to how WordPress tracks your ...


1

Pitta Migration Description Migrates the database wp_options to match WP_HOME and WP_SITEURL Type Plug & Play, no config needed beyond setting the WP_HOME and WP_SITEURL constants Download Link https://wordpress.org/plugins/pitta-migration/ Related Question How to: Easily Move a WordPress Install from Development to Production?


0

You could create a custom post type of "Static Pages" that do not allow you to update the titles. remove_meta_box( 'post_title' , 'your_custom_post_type', 'normal' ); remove_meta_box( 'slugdiv' , 'your_custom_post_type', 'normal' ); Then add in your static pages programmatically with wp_insert_post(); and force the slug and post_title to what you want. ...


0

First, always develop with debugging enabled. That white screen will now contain error messages to help you determine the problem. Refer to the action reference to see the order in which things happen during the load process. Your plugin is loaded before the plugins_loaded action, which is when your code runs. However, note that the current user isn't ...


0

Plugins run a lot earlier than themes - you need to delay the execution using a hook: /** * Fire once WordPress is ready and conditionally hook our handler. */ function wpse_199197_init() { $user = wp_get_current_user(); $allowed_roles = array( 'author' ); if ( array_intersect( $allowed_roles, $user->roles ) ) add_filter( ...


0

It is hard to advise on issues like that, since they are specific to your installation. In a very general sense one of two categories of issues can cause it: You are not doing what you think you are doing. An example would be placing files into wrong server/folder. Your server is not doing what you think it is doing. An example would be PHP code loaded ...


0

Follow the following steps to achieve your result, Use get_terms to fetch all of your parent taxonomies and render a drop-down with the title and setting a data attribute with the term ID. Please set the args "parent" to 0 and taxonomy to your taxonomy slug. Write a jQuery script to fire an AJAX on the above created drop-down. The AJAX should send the ...


1

Use tis plugin https://wordpress.org/plugins/acategory-dropdown-list/ It may be help you


0

1) If you want to perform certain operation as a first activity after the save button click, then you would have achieved it via server side script (here PHP) by hooking into some action, but as you are clearly specifying that you want client side action only, I think there is no straightforward way to control the order of the even like click. However, one ...


0

also this is my class file content: <?php class Contact_Widget extends WP_Widget{ /* * Plugin Constructor */ function __construct() { parent::__construct( 'contact_widget', // Base ID __( 'Ajax Contact Widget', 'text_domain' ), // Name array( 'description' => __( 'Ajax powered contact widget', ...


0

this is my plugin content: <?php /** * Plugin Name: Ajax Contact Widget * Plugin URI: http://aliqorbani.com/plugins/contact-widget * Description: just a simple contact widget plugin. * Version: 1.0 * Author: Ali Qorbani * Author URI: http://www.aliqorbani.com * License: GPL2 */ /* * include JS */ function add_scripts(){ ...


1

See the WordPress Codex page on Widgets API and utilize the update() function in your widget class declaration as used here and add a script call in the appropriate place: /** * Processing widget options on save * * @param array $new_instance The new options * @param array $old_instance The previous options */ public function update( $new_instance, ...


0

wp_iframe doesn't actually create an iframe it just applies it in a special div. Therefore, my way around this is just scoping my CSS to be specific to what I want to display with my added CSS.


0

The code contained the line add_action( 'admin_init', 'my_admin' ); at the end, but my_admin wasn't declared anywhere. Changed it to all_post_types, my function to register all the custom post types at once and it worked.


4

You need to listen for the click event (there is no such thing as a pre/before click) and do some work right then or figure out if you want to allow the click to "go through" or not based on some validation for example. jQuery(function($) { // We are binding to the body so that the code // will work for future elements added to the DOM ...


0

Firstly, remove the margin-left CSS property from your html and then try if it works. May be your html is being hidden behind any other html. Or better try this first - Remove the current code from your function and just write any non html thing. Then put a die() or exit() and see if it's being rendered properly. Then you can do further debugging.


0

1st alternative is to use the CDN. When using it the icons are visible: https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css 2nd alternative is to include all resources necessary. When you are using only the min CSS, the console is marking the following resources as not found but required : GET ...


0

Just giving you a general idea which may help you. You can try something like below in WordPress - 1) Add a functionality to have usermeta as active or pending e.g. update_user_meta($user_id, '_user_custom_status', 'active'); 2) Do not show any post for non logged in user. 3) On login, check for user with subscriber role and check its status from ...


0

The syntax is not 'post-type' or 'post-status', it is with an underscore instead of a dash: 'post_type' => 'testimonials', 'post_status' => 'publish',


0

The question is from a long time ago but, just for reference, in this particular case and if somebody simply wants to use the checked function with what seems to be an array (instead of doing the test and output 'checked` on the spot) here is a drop-in solution: checked( in_array( $shopCategory->term_id, $term_meta['ss_aff_categories'] ) ) This works ...


0

After so much research I figured it that the issue is due to a custom function I was trying to hook to the product page. All this while the custom function was wrongly hooked and I corrected it now.


3

When using plugin_dir_path() like you do: plugin_dir_path( __FILE__ ); It does return something like: /var/www//wordpress/wp-content/plugins/your-plugin/ So it adds a trailing slash, because as the documentation states: It is a wrapper for trailingslashit( dirname( $file ) );. So remove the slash before the file in your calls: require_once ...


2

The script_loader_tag filter, added in version 4.1, addresses this issue. To add an async attribute to an enqueued script you can do: /** * Add an aysnc attribute to an enqueued script * * @param string $tag Tag for the enqueued script. * @param string $handle The script's registered handle. * @return string Script tag for the enqueued script */ ...


0

You have to update post meta _price and _regular_price. As woocommerce stores each variation of product as a single product. So instead of passing variable products id you need to pass variation id to update_post_meta.


0

If you need to change the permalink structure, it can be done in admin panel. Go setting -> permalinks and chose what you need in general settings


0

My suggesion is to use wp_localize_script() to pass the post id to your AJAX calls. Something like this.. function my_script_enqueue() { global $post; $translations = array( 'postID' => $post->ID ); wp_enqueue_script( 'myscript', '/url/to/your/script.js', array('jquery') ); wp_localize_script( 'myscript', 'MyAJAX', ...



Top 50 recent answers are included