w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Cat + Tag Filter Plugin for WordPress: Checkboxes not being saved
Unfortunately, there is a well documented list of issues with this plugin and not a very good response rate from the plugins creators. Some posts recent about the plugin are saying that it doesn't work at all with Wordpress 3.6. Your options are some what limited, you can put a bounty on the issues and try and attract some to do a custom fix on the issues for the plugin, you can hold out for a plugin update or you can try implementing something like Isoptope for Wordpress (this has a bit learning curve to use). Lastly, I just found that if you have the Yoast or Pretty Permalinks plugins installed there are documented conflicts with these plug-ins and Cat+Tags filter so you could try turn some of your plugins on and off to see if this fixes the issue for you. I hope this helps some.

Categories : PHP

How to call WordPress plugin function without the entire plugin
So after some advanced Googling and trial and error, I figured it out: Note: before calling a function from a plugin, it is a good idea to check and make sure the plugin is activated. To do this with this particular plugin I used include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if(is_plugin_active('widget-context/widget-context.php')){ ... } Next, this widget uses a php public class that already exists, so in order to use it again, I needed to set this class as an object to a variable like this; if(class_exists('widget_context')){ $my_widget_context = new widget_context(); } Next, some plugins require to load by executing a certain function. Again for the widget-context plugin, I needed: $my_widget_context->load_plugin_settings(); Now, I could succsessfully ca

Categories : PHP

WordPress Filter: Replace full content before page renders
If you're writing a plugin, you can use PHP function ob_start() to cache whole buffered content. After that you can use callback function to return replaced content. Use triggers (action's) init or after_setup_theme for your script.

Categories : Wordpress

Wordpress overloading PHP function from plugin A in plugin B
The best way to add functionality is to decompose the plugin and seperate the behaviours. If the plugin is not designed with extensibility and customizability in mind you're going to have a hard time, especially if you want updates to have no breaking changes. For instance: you might need access to a private function or property, you can't do that if you inherit/override. The function or property might even be gone when you update to a new version of the plugin. Inheriting from a class that is not abstract or designed to be inherited from is a code smell.

Categories : PHP

passing a variable to an anonymous function in a wordpress filter
The params you can provide to custom filters are defined by the filter and the way filters work in Wordpress. See http://codex.wordpress.org/Plugin_API/Filter_Reference for documentation about filters in Wordpress. Also you're not the first attempting this so maybe this will help you (as I don't have a Wordpress install to test it with): http://wordpress.org/support/topic/change-the-title-dynamically If you can't get it working I would suggest using the forum of the plugin you're using or contacting the developer directly.

Categories : PHP

target a custom page using plugin function in wordpress
You can use these hooks for page templates. http://adambrown.info/p/wp_hooks/hook/page_template Or may be something like this... add_filter( 'page_template', 'check_the_template' ); function check_the_template( $template ) { if( 'custom_page.php' == basename( $template ) ) { // do some things here by calling functions, hooks etc.. } return $template; } If you want to just echo "Hello World" : add_filter( 'page_template', 'check_the_template' ); function check_the_template( $template ) { if( 'pagetemplete.php' == basename( $template ) ) { add_action( 'the_content', 'echofunction' ); } return $template; } function echofunction() { echo "Hello World"; }

Categories : Wordpress

wordpress add multiple callback function to single ajax action from different plugin
This is untested, but I'd try to solve it removing the original actions after all plugins are loaded, and then adding your substitute: add_action( 'plugins_loaded', 'b5f_new_ajax_coupon', 15 ); function b5f_new_ajax_coupon() { remove_action( 'wp_ajax_woocommerce_apply_coupon', 'woocommerce_ajax_apply_coupon' ); remove_action( 'wp_ajax_nopriv_woocommerce_apply_coupon', 'woocommerce_ajax_apply_coupon' ); add_action( 'wp_ajax_woocommerce_apply_coupon', 'b5f_ajax_apply_coupon' ); add_action( 'wp_ajax_nopriv_woocommerce_apply_coupon', 'b5f_ajax_apply_coupon' ); } function b5f_ajax_apply_coupon() { // COPY THE ORIGINAL /woocommerce/woocommerce-ajax.php#L57 // AND ADAPT TO YOUR NEEDS }

Categories : PHP

Externally add a function to a WordPress Plugin's PHP file (Allowing for easy version update)
I would recommend adding this in a different plugin. paypall-totals.php in your wp-content/plugins (don't forget to activate in the wp-admin) /* plugin-name: paypall totals description: adds a function to show paypall totals pluginURI: http://stackoverflow.com/q/17066291/933065 */ function paypall_total_items() { session_start(); $grand_total = 0; foreach ((array)$_SESSION['simpleCart'] as $item){ $total += $item['quantity']; } $grand_total = $total; return number_format($grand_total); } Since it only gets it's data out $_SESSION it doesn't matter where you put this function. It also would work in your theme functions.php Also adjust the code in the header.php: echo paypall_total_items(); Just restore the paypall plugin to it's original code. Let

Categories : PHP

Wordpress Plugin not loading CSS on the plugin's option page in the admin menu
Figured it out... It was the line: add_action('admin_print_styles-'.$page, 'my_admin_enqueue_styles'); Since I'm doing all this inside a class, I need to pass the second parameter as an array with $this add_action('admin_print_styles-'.$page, array($this, 'my_admin_enqueue_styles')); I did it with the other hooks, just missed this since it's not done that way in the codex. Silly me.

Categories : Wordpress

Commit Failed While Uploading My Plugin to Wordpress Plugin Repository
I was having the same problem, and what solved it for me was to do the initial SVN Checkout to my local directory using https://plugins.svn.wordpress.org/[plugin-name] instead of http:// like I had been doing. After that, I was able to commit new changes and create new tag versions.

Categories : Wordpress

Wordpress Print Version | Access Wordpress core functions in a plugin
All WordPress functions are available in a plugin. The matter is hooking in the right place. Simple example: <?php /** * Plugin Name: Test Plugin */ // This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated add_action( 'wp_loaded', 'plugin_so_18538270' ); function plugin_so_18538270() { // Admin area, do nothing if( is_admin() ) return; // "true" == $var // See Yoda Conditions: http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html if( isset( $_GET['print'] ) && "true" == $_GET['print'] ) { // some code exit(); } } References: Writing_a_Plugin and Plugin_API at the Codex. Highest voted Questions in the <Plugin-Development> tag at WordPress Answers.

Categories : PHP

JQuery Replace "Special" Function (like replace(/#[^#]*$/, "") replace(/?[^?]*$/, ""))
They are called regular expressions. Regular expressions are patterns used to match character combinations in strings

Categories : Jquery

AngularJS multiple filter with custom filter function
Try this: <tr ng-repeat="player in players | filter:{id: player_id, name:player_name} | filter:ageFilter"> $scope.ageFilter = function (player) { return (player.age > $scope.min_age && player.age < $scope.max_age); }

Categories : Javascript

Overriding a plugin's function from another plugin/extended class
you can use remove_action() to remove the functions your free version does. And in the pro version you could only include the MyFreePlugin file and then extend.

Categories : PHP

Using row filter and replace in datagridview
The method below retrieves the data source of the dataGridView1as a DataTable and it clones it to a new DataTable. Then, it parses the Rows collection of the original DataTable, it replaces the looked up value (given by textBox6.Text) with the _TEST_ value in the Stringtext column and it adds the modified rows to the cloned data table. Lastly, it assigns the grid's data source to the modified table. private void button7_Click_3(object sender, EventArgs e) { var original = ((DataTable)dataGridView1.DataSource); var clone = original.Clone(); var ordinal = original.Columns["Stringtext"].Ordinal; for (int i = 0; i < original.Rows.Count; i++) { var values = original.Rows[i].ItemArray; values[ordinal] = values[ordinal].ToString() .Replace(textB

Categories : C#

wp_insert_post_data() filter for metabox plugin
Yes, it's just a matter of doing your wp_insert_post_data inside the callback for the action hook save_post. Examples: using meta boxes and save_post with wp_insert_post and with wp_update_nav_menu_item.

Categories : Wordpress

get filter plugin query for an enhanced grid
Just do : grid.getFilter() This returns an array of filter object, each object having the following properties : { colTxt: "Year" column: "3" condTxt: "contains" condition: "contains" formattedVal: "2003" type: "string" value: "2003" }

Categories : Javascript

How to decode a WordPress plugin
It's hex encode and the reverse is this: http://ddecode.com/hexdecoder/?results=463d2f6124f0e50b67194fba93b8ab28 I really hate hate when programmers do this stupid kind of things! It's totally useless.

Categories : PHP

Wordpress Charts Plugin?
I would like to recommend you to take a look at Visualizer plugin. It is sophisticated tool to build neat and professional looking charts. This plugin allows you to upload CSV file or to use Google Spreadsheet document as data source. Take a read the plugin's knowledge base to figure out how to use it. A couple of screenshots:

Categories : Wordpress

SQL Export - Wordpress plugin DEV
It depends a little how your export_file() function is being called. But if it's called directly from an admin URL, you can add &noheader=1 to the URL. I use that successfully when generating an Excel file.

Categories : PHP

Using AJAX in a WordPress plugin
You need to add an 'action' to your AJAX call. jQuery.ajax({ type: "POST", url: "/wp-admin/admin-ajax.php", data: newcontact, action: 'addcontact', success: function(data) { jQuery("#feedback").html(data); } }); The value should be the same as the add_action hook to wp_ajax. e.g. add_action( wp_action_{action_value}, 'myfunc' ); This allows WordPress to know which function to run when the AJAX call is made. This Codex page has some useful info and this article describes how to better refine the code you have.

Categories : PHP

WordPress DB search and Replace
This is the SQL I use; if you use Navicat or SequelPro you can save it so you can run it each time you import data (e.g. when grabbing the latest DB from a staging site to work on it locally): UPDATE wp_posts SET guid = REPLACE (guid,'http://www.oldsite.com','http://www.newsite.com'); UPDATE wp_posts SET post_content = REPLACE (post_content,'http://www.oldsite.com','http://www.newsite.com'); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value,'http://www.oldsite.com','http://www.newsite.com'); UPDATE wp_options SET option_value = 'http://www.newsite.com' WHERE option_name = 'siteurl'; UPDATE wp_options SET option_value = 'http://www.newsite.com' WHERE option_name = 'home'; Or you could use https://github.com/veloper/WordPress-Domain-Changer which you need to upload and then delete

Categories : Wordpress

wordpress bloginfo filter name and description
In add_filter( 'filter_hook', 'your_function', 10, 2 ); expression, the 10, 2 parameters are: the first: the priority of your filter function during the execution of all filter functions. it is a number between 1 and ∞ ( use a reasonable one : ) ), many thanks to @brasofilo: look here. the latest: the number of parameters that will be passed to your function. The number of parameters declared and the number of parameters passed has to be the same. Take a look to WordPress Codex Plugin API Hope it helps!

Categories : Wordpress

Wordpress Taxonomy Category Filter
you must try with the taxonomy term like below <?php $args = array( 'post_type'=> 'realestate', 'taxonomy' => 'realestate_cat', 'term'=>'your taxonomy term' 'cat' => 2, ); query_posts( $args ); if (have_posts()) : while (have_posts()) : the_title (); the_post(); ?>

Categories : Wordpress

maven-ear-plugin unpack, filter and repack jarModule
You can use the TrueZIP Maven PLugin to remove files from an archive: <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>truezip-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <id>remove-from-jar</id> <phase>prepare-package</phase> <goals> <goal>remove</goal> </goals> <configuration> <fileset> <directory>${project.build.directory}<someFolders><I-contai

Categories : Misc

need assetic filter to replace variables in JS oder CSS files
Return css as a controller response. /** * @Route("/style.css") */ public function styleAction() { $response = new Response(); $response->setContent(/* make your css */); $response->headers->set('Content-Type', 'text/css'); return $response; }

Categories : PHP

Cannot get WordPress plugin to paginate correctly
You should use wp_link_pages for the pagination. The for logged in users, use the_content filter to show the content without the pagination. e.g., in your post.php (or whatever template) file if( is_user_logged_in() ) : echo apply_filters( 'the_content', $post->post_content ); else : the_content(); wp_link_pages( $my_args ); endif;

Categories : PHP

Load .js file from wordpress plugin
You can do like this using admin ajax : I will not explain the functions . you can google it and learn . Step 1: Localize some values for your script to be used in your javascript files, get admin-ajax.php url $author_nonce = wp_create_nonce( 'nk_author' ); wp_localize_script( 'nk_script', 'nk_object',array( 'nk_ajax_url' => admin_url( 'admin-ajax.php' ) , 'nk_plugin_url' => plugins_url() ,'nk_author' => $author_nonce) ); step 2 : In your script you can do this . var data = { action: 'nk_action', // the function that will be called in your plugin _ajax_nonce : nk_object.nk_author, // nonce for security id : 'mydata' //your data to be sent }; //(admin ajax url , your data , callback for response ) jQuery.post(nk_

Categories : Javascript

Wordpress plugin, database not creating
Add this in your page, add_action('init','create_wispabb_table'); Or register_activation_hook(__FILE__, 'create_wispabb_table');

Categories : PHP

How to add a Bubble Notification to a WordPress plugin?
If you had researched for "bubble" at WordPress Answers, you'd have found, if not a solution, very good hints. From this Answer, an adapted example to add 10 to Advanced Custom Field plugin menu. Check the code comments: add_filter( 'add_menu_classes', 'add_plugin_bubble_so_17525062'); function add_plugin_bubble_so_17525062( $menu ) { $pending_count = 10; // Use your code to create this number foreach( $menu as $menu_key => $menu_data ) { // From the plugin URL http://example.com/wp-admin/edit.php?post_type=acf if( 'edit.php?post_type=acf' != $menu_data[2] ) continue; $menu[$menu_key][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n($pending_count) . '</span&g

Categories : PHP

create widget for wordpress plugin
In your function getLosninger, you start an output buffer ( ob_start() ), but you don't do anything with it. You might be safe removing that line of code, or at least capturing the contents of the output buffer and flushing it.

Categories : Wordpress

wordpress plugin to include files
Why are you sure the code is not correct? What is not working? What errors have you received? Please read the guidelines on asking questions. Some tips. The slugs for wp_register_script/style should be that - put them in lowercase and swap the spaces for - jQuery is loaded in noConflict mode (for good reason) by default. This means you should use 'jQuery' rather than '$' for your selectors. It's generally better to put your scripts in their own file and enqueue them like the others (that removes the need for the wp_head call.

Categories : Wordpress

Wordpress rewrite url to plugin file
As the tag I was using not any of the type (e.g. posts, pages, category, author, search).. and also pretty urls may not be enabled on the wordpress . I cannot use add_rewrite_rule(); if I need to use add_rewrite_rule() then pretty urls must be enabled. So only way to rewrite the url is by editing the htaccess file. so this is the function which needs to be called to save the rules to htaccess on plugin activation function mod_rewrite_rules($rules) { $home_root = parse_url(home_url()); if ( isset( $home_root['path'] ) ) $home_root = trailingslashit($home_root['path']); else $home_root = '/'; $rules = array(); $rules[] = "<IfModule mod_rewrite.c>"; $rules[] = " RewriteEngine On"; $rules[] = " RewriteBase $home_root"; $rules[] = " RewriteRule ^oauth/fac

Categories : Wordpress

How to create a fpdf wordpress plugin
The question is, how do you convert your html to pdf output? To get your PDF to look like your webpage, that is, with all the html+css, I don't believe this library will do it. If you just want to get the post_content from a post, and put it into a pdf, you could do this: To create a plugin: You'll need to add a folder to /wp-content/plugins/ and create your plugin file in that folder: /wp-content/plugins/fpdf/fpdf.php /* Plugin Name: fpdf Description: Post to PDF */ // Here's where you'll write your code. $post = get_post( $post_id ); require('fpdf.php'); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,$post->post_content); $pdf->Output(); This would output a pdf on every page load, after you activate the plugin, which is not li

Categories : Wordpress

.click() not working in WordPress Plugin
Use jQuery event delegation for generated elements: $("#results").on('click','#addtoPlaylist',function(){ alert('clicked'); });

Categories : Jquery

Using $this when not in object context. wordpress plugin
use $this->render() instead of $this->class->render(); another is: add ucfirst because your class name is in first letter capital and you are passing small case in arguments. $this->controller = call_user_func_array(array(ucfirst($this->class), $this->method), $this->args)

Categories : PHP

add_menu_page() not working on plugin in wordpress
The capability "edit_options" you have in your add_menu_page code does not exist according to the WP Codex. Try changing it to something like "edit_theme_options".

Categories : PHP

WordPress Plugin Development - How to Set a Locale
Or does wordpress automatically selects a plugin language based on the WordPress installation? That's very much exactly what it does. You need to define the language in your config file (by defining WPLANG). WP picks it up from there and localizes strings the best it can according to your chosen locale.

Categories : PHP

wordpress plugin including javascript
I would suggest using wp_localize_script instead of attempting to dynamically generate your script. This will allow you to access any variables you build in your script within the rendered javascript. For example: wp_register_script('woo_tool_js', plugins_url('tooltip.js', __FILE__) ); wp_localize_script('woo_tool_js', 'my_data', array( 'key' => 'value' )); wp_enqueue_script('woo_tool_js'); ...will allow you to access the my_data array as an object in your javascript: console.log(my_data);

Categories : Jquery

Wordpress- how to disable plugin update
In the plugin file, there will be a function that will check for updates. The original author could of named this anything, so you will have to go through the code and check each function and what it does. I would imagine the function will be quite obvious as to what it does. Alternatively you can add this to your plugin file: add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 ); function dm_prevent_update_check( $r, $url ) { if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) { $my_plugin = plugin_basename( __FILE__ ); $plugins = unserialize( $r['body']['plugins'] ); unset( $plugins->plugins[$my_plugin] ); unset( $plugins->active[array_search( $my_plugin, $plugins->active )] ); $r['body']['plug

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.