Tag Info

New answers tagged

0

A better method for what you are trying to achieve This answer is not about the php error you are getting. You need these classes for styling your website right? Put the following code in your functions.php // A better body class function condensed_body_class($classes) { global $post; // add a class for the name of the page - later might want to ...


0

Keep in mind this will only work if you're on a single page or post, because when you're displaying the output of a loop, you don't yet have a post until you've started the loop (or, you might have the first post in the loop, but either way that's not what you'd want to set a body ID for). I'd recommend wrapping this ID with two conditionals: <?php ...


1

If you want to keep your log on the server, try using php's error_log() which is more flexible than just writing to files on disk. Something along the lines of: add_filter('manage_edit-member_columns', 'set_custom_edit_member_columns'); function set_custom_edit_member_columns($columns) { error_log(print_r($columns,true),3,__DIR__."/log.txt"); ...


0

When a var_dump or any other screen output is not posible, you can use error_log. The message will be added to the error_log file on your server. To log variables I like this small function: function log_it( $message ) { if( WP_DEBUG === true ){ if( is_array( $message ) || is_object( $message ) ){ error_log( print_r( $message, true ) ); ...


0

Place the following function in your functions.php: function wpse_178547_log( $message ) { file_put_contents( 'custom.log', date( "d-m-Y H:i:s" ) . ' ::::: ' . $message . PHP_EOL, FILE_APPEND ); } Then: function set_custom_edit_member_columns($columns) { wpse_178547_log('$columns'); foreach($columns as $column){ ...


1

Any messages you are seeing with the debug output should be resolved. These often point to holes in the current logic within your theme. If your goal is to submit the theme to the WordPress Theme Directory you have to resolve any PHP errors, warnings, or notices for the theme to be approved. Themes must not generate any Theme-Check Warning or ...


0

My configuration is not fully functional so this isn't really an answer ... but I wanted to share my thoughts and some information on what I've tried to get this set up so far. My setup was pretty much the same as that described by Borek. Plugins in one directory on my file system Clean WP 4.1 in another directory on the file system attached as a library ...


0

I am assuming that you already followed the tutorials on setting up xDebug on PHP installation and PhpStorm. Let me know if you need some help with that. I am using xDebug Helper extension on Chrome. Install it too. With the extension installed: In PhpStorm, go to Run > Start Listening for PHP Debug Connections. Set a breakpoint in your code. Go to ...


2

Resolved by following comment on Tutsplus Tutorial (link included): In function save_meta(), replace this line: if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__))) with this line: if (!isset($_POST['custom_meta_box_nonce']) || !wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__))) See full comment here.


0

I'm using PHPStorm, and everything you describe should work. The only thing is that you need to install and configure xdebug via wamp to be sure it's running.


0

I cheated by checking out my plugin into the wordpress plugins directory (can't remember if I tried a sim link or not), opening a PHPStorm project on the whole wordpress install and just debugged from there. Maybe not what you wanted but I was up and running in 5 mins.


1

Although the actual question is off topic, I would make a few alterations to the code to make it more reliable and a bit faster and less resource intensive: Add $content = ''; right at the top of the function, this will take care off the Notice: Undefined variable notice Only get the term id's from wp_get_post_terms(). This will make this function faster ...



Top 50 recent answers are included