Tag Info

New answers tagged

0

I tried creating a shortcode in my custom plugin, but in order for it to work, you need to apply a filter that converts all the new shortcodes you created to the content. Where the content is being rendered (like in the single.php file), replace the_content() with apply_filters('the_content',get_the_content())


0

Firstly I'd suggest wrapping your JS like this: (function ($) { $(document).ready(function(){ $("#Yes").click(function(){ $(".apptype").show(); $(".specify").hide(); }); $("#No").click(function(){ $(".specify").show(); $(".apptype").hide(); }); }); }(jQuery); You're ...


1

Use a multisite. There are no good reasons not to do that. For the groups I would use two custom tables: A group table for the description, maybe an image path/ID an a group ID. You could also use a custom post type on the main site for that, but it is easier to optimize the queries for a custom table. A group_users table to associate user IDs with group ...


0

The add_submenu_page first parameter should be the top menu page handle which in you case is a-qoute so: function a_qoute_admin_action(){ add_menu_page( __('Reservations Pages'),// the page title __('Donation'),//menu title 'edit_themes',//capability 'a-qoute',//menu slug/handle this is what you need!!! ...


1

Best free plugin for your goal is Polylang: http://wordpress.org/plugins/polylang Not so great but still easy to use is mqTranslate, which is a fork of the pretty popular qTranslate: https://wordpress.org/plugins/mqtranslate/ A good popular (but paid) one is WPML: https://wpml.org


0

You need to read about the Settings API and Options API Plus you can find a detail tutorial here too. http://www.paulund.co.uk/theme-options-page


0

Unfortunately, the plugin author did not leave room for a filter. But I did request one for you here. I suggested changing: /* Add option page */ function cd_setting_page(){ add_options_page( 'Commenter data Settings', 'Commenter data Settings', 'administrator', 'commenterdata-settings', array( $this, 'cd_renderer' )); } to /* Add option page */ ...


0

admin_init Hook or load-(page) Hook seems to work, WordPress has not been set header in this state. I'm using load-(page) Hook because it runs when an administration menu page is loaded. You can load your script for specific page. You can check load-(page) Hook on WordPress Codex If you're using admin_init Hook make sure to verify nonce using ...


0

Here is a snippet that assign author role to a new registered member whose email is somtehing@anotherthing.co.uk where you need to modify to fit your needs: add_action( 'user_register', 'user_register_cb', 10, 1 ); function user_register_cb( $user_id ){ $user_info = get_userdata( $user_id ); $email = $user_info->user_email; $domain = ...


2

Below I've included two hooks you could use. There may be better hooks depending on what you're trying to accomplish exactly but this is what you've asked for. At the bottom I've listed some helpful resources: Publish Post Hook http://codex.wordpress.org/Plugin_API/Action_Reference/publish_post function published_post( $ID, $post ) { if( ...


0

After uploading the plugin file to a directory inside your theme, you will want to enqueue the plugin file in functions.php You should already have a similar function in your functions.php file, but if you don't yo can add it. Change false to true if you want the file to load in the footer instead of the header. In this example I put the file inside a ...


1

I think MailPoet gets pretty close, you can setup a template, drag and drop posts, etc. You can even have it send via Mandrill or Railgun, etc if you want. Otherwise it doesn't seem like it would be that hard to to setup the generated HTML. It's really the "choosing posts" that's the hard part since there's a ton of ways to go about it. You could spit out ...


0

You could do this using the WordPress uninstall.php support: <?php if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); global $wpdb; $wpdb->query( "DROP TABLE IF EXISTS NestoNovo" ); delete_option("my_plugin_db_version"); ?> This uninstall.php file is called when your plugin is deleted.


0

I have done this (Woocommerce 2.1) by creating a template for the product in my theme's woocommerce templates named 'content-single-product-{$product_cat}.php' and adding a 'wc_get_template_part' filter that searches for templates named after the product category. Now you can override the content-single-product template by product category: function ...


0

You should use $_SERVER[] global array to get the url of the page. The simplified syntax is: $request_url=$_SERVER['REQUEST_URI']; You can then use the variable $request_url where you need the url.


0

have you looked at $_SERVER $real_address = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo $real_address; This code grabs your url with it's parameters and saves it to the $real_address variable Also have a look at this link here


0

Please try this code: function test_db_install() { global $wpdb; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); $sql=" CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."imart_setting` ( main_id bigint(20) NOT NULL auto_increment, main_key varchar(255) default NULL, main_value longtext, ...


0

You are getting this error because 'wpmyfirstplugin_createTable' is called on register_activation_hook. This hook is called when a plugin is activated from dashboard and before declaring any variable. So when this function runs it does not get the table name parameter.


0

This is how I'm calling a taxonomy template from a subdirectory within my theme folder. Keep in mind that taxonomy.php will need to stay in your root theme directory. function call_taxonomy_template_from_directory(){ global $post; $taxonomy_slug = get_query_var('taxonomy'); load_template(get_template_directory() . ...


0

Specific Events Manager template tags are another way to achieve this, for example: <?php echo EM_Events::output(array('scope'=>'tomorrow', 'limit'=>10, )); ?> You can use any of the attributes. (http://wp-events-plugin.com/documentation/event-search-attributes/) One of the attributes is, 'format', which formats the output and lets you use ...


2

The solution that we have gone with in the end uses a single call to get_user_meta passing just the $user_id - this way all user data is returned in a single query, reducing a heavy load on the DB during large user data exports. We then run a series of checks against the returned data - including: is_serialized( $value ) - to check if the data has been ...


0

Not sure if this is the actual answer for this but on line 252 of the pastebin link change: <form action="'.site_url().'/wp-admin/admin.php/options-general.php" method="get"> to <form action="'.admin_url('options-general.php').'" method="get"> When I submitted the form in the settings it giving me a not found error.


0

The correct way to automatically mark a post as private is to do it with the wp_insert_post_data filter. It's very straightforward: add_filter('wp_insert_post_data', 'mark_post_private'); function mark_post_private($data) { if($data['post_type'] == 'your_post_type_goes_here') { $data['post_status'] = 'private'; } return $data; }


1

In setup, set the plugin folder root: $this->plugin_root = wp_normalize_path( WP_PLUGIN_DIR ); Then modify filter to check if file is in theme root or plugin root: return $this->switch && ( strpos($norm, $this->root) === 0 || strpos($norm, $this->plugin_root) === 0 ); or to show all included files, don't filter any of the results in ...


2

If your code uses wp_mail function to send emails, then you can specify multiple recipients using an array or a comma-separated string. So your $emailTo will be.. $emailTo = array( 'ponim@orot.ac.il', 'email1@example.com', 'email2@example.com', ); If your code does not use wp_mail function then you can define multiple instance of PHP mail ...


1

To disable plugins using the find and replace option in Migrate DB, search for the file path to the plugins main PHP file, and replace it with nothing. To disable W3 Total Cache for example, you would search for w3-total-cache/w3-total-cache.php and leave the replace field empty. Explanation WordPress stores the active plugin data in the active_plugins ...


-2

What resolved for me on Lubuntu 14 was the following: chown www-data:www-data /var/www/html -R


0

Hey If you want to improving your text editor for post and pages then use Gust Wordpress Plugin Gust I think you like it.


1

There's a small PGP plugin by Tim Nash on GitHub (but it's not in the official Wordpress repository, it needs to be manually copied to wordpress plugin directory). It's a wrapper using php-pgp library for encryption. The article where I found this link is "Encrypting emails with PGP and WordPress". This is the only Wordpress solution I have found so far. I ...


2

You can register TinyMCE plugins using mce_external_plugins filter: add_filter('mce_external_plugins', 'my_tinymce_plugins'); function my_tinymce_plugins() { $plugins_array = array( 'my-tinymce-plugin-name' => 'tinymce-plugin-url-of-js-file' ); return $plugins_array; } You can add that code to ...


0

If you downloaded it from CodeCanyon or similar, unzip the download package first, then upload the real plugin zip. Often there are licensing and documentation and source files included that are not part of the installable.


0

There's no way to magically extract and migrate articles from within a JPA backup file directly into WordPress. You can use Akeeba eXtract Wizard to extract the database file from the JPA file and then you have access to the article HTML via a text editor but you'll need a working copy of WordPress to be able to import the articles by whichever method you ...


0

Updating the posts would involve the destruction of data. Making sure you only update the posts that have been updated, with zero accidental clashes were 2 unrelated posts had the same title, or if the post was updated in the import, and on the site, etc etc. It's safer to simply not update, thus ensuring there is never a loss of data. This question ...


0

I can see both sides of the coin in the situation and they are reasonable. If you are interested in this feature for this plugin and the plugin otherwise meets your needs, I would say re-write the section of the plugin which handles this evaluation and add in the allowance for an optional argument (boolean in this case should be fine) that acts as a flag to ...


0

Use filter content_save_pre exactly like the_content -- the difference is that it operates when a post is saved, rather than displayed. http://codex.wordpress.org/Plugin_API/Filter_Reference/content_save_pre


-1

You could try this: function restricted_access() { if( ! is_user_logged_in() ) { global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( 'wp', 'restricted_access' ); By default, always, if the user is not logged in it will give them the 404 page. The following two functions will keep non-admins out of ...


0

Any restriction on IP based on wp-admin panel ? Try to restrict Login LockDown plugin to restrict admin panel.


1

By default, get_terms will only return those tags that have some posts attached to them already. Try: $tags = get_terms( 'sizes', array( 'number' => 999, 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => false, ) ); The hide_empty parameter will override this behaviour. EDIT: I removed the 'taxonomy' parameter for ...


0

I was able to keep the $postCount variable counting by starting a php session in my functions.php file function init_session() { session_start(); } add_action( 'init', 'init_session', 1 ); ...and setting up my loop like so: [...] <body> <div class="posts"> <?php $postCount = 0; if ( is_paged() ) : ...


1

WP_Query has a $post_count variable. http://codex.wordpress.org/Class_Reference/WP_Query#Properties Just pass that with the script using wp_localize_script


-1

In wordpress exists wp_is_mobile() function.This may help you. You must see how is named cufon handle in plugin if(wp_is_mobile()){ wp_dequeue_script( 'cufon_handle' ); }


2

Quite simply, it's loading more than once because you're probably actually making more than one HTTP request to "WordPress". You should not do anything like counting on a plugin load like this, because WordPress can load in many different situations, sometimes more than once for even a single page view. The wp-cron process, for example, can run in the ...


0

Hey by using enqueue script to add all js and css file wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); Example here /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_directory_uri() . ...


1

Thanks to diggy from StackOverflow I've foudn that in the WordPress cycle, the file vars.php (containing my needed functions) is included after muplugins_loaded executes. Including wp_is_mobile() and current_user_can() in wrapper functions fixed my problem. CORRECT function my_epic_function() { if(current_user_can( 'edit_posts' )) { ...


1

Here are two untested ideas: Idea #1: If you want to hook before an instance of the Plugin_Upgrader class is created with: $upgrader = new Plugin_Upgrader( ... ) where the upgrades are activated with: $upgrader->upgrade($plugin); // for a single plugin upgrade $upgrader->bulk_upgrade( $plugins ); // for bulk plugins upgrades then you ...


1

While there are a lot of plugins that adds rating type of stars, I would suggest that you code your own. Mainly because most of these are very feature rich with things you will not need. This is a relatively simple process: Add a custom user metadata using update_user_meta(), name it posts_voted. Add a custom post meta value using update_post_meta(). The ...


0

Try passing the content of each shortcode through apply_filters( 'the_content', $content ); - you may not be getting your shortcode output because it's never being called in the first place (beyond the top level). the_content filter include do_shortcode() (from memory), which is what you need. See how it goes...


0

This is called Post Thumbnails. It was set by your theme. You can open file functions.php and search for set_post_thumbnail_size. If found, change it : set_post_thumbnail_size(9999999,999999) If not found, just insert new line.


0

This can be achieved by either creating an image size using <?php add_image_size( 'my-image-size', 1000, 400, true ); ?> or you can implement the Aqua Resizer to your theme/plugin. Aqua Resizer works almost in the same fashion as the good old TimThumb, but instead saves the image as a correct image size in WordPress using WordPress' intermediate sizes ...


0

Why don't you directly echo the $num as it will contain the count of rows already...Here's the edited part.. //To show number of rows in table function DB_Tables_Rows() { global $wpdb; $table_name = $wpdb->prefix . 'mydata'; $count_query = "select count(*) from $table_name"; $num = $wpdb->get_var($count_query); echo $num . ...



Top 50 recent answers are included