How to return multiples lines in a shortcode?
Don’t use output buffering. It is too slow and sometimes hard to debug. Use heredoc. Example: $output = <<<MYUNIQUENAME <div>$foo <p>Some $bar</p> </div> MYUNIQUENAME;
Don’t use output buffering. It is too slow and sometimes hard to debug. Use heredoc. Example: $output = <<<MYUNIQUENAME <div>$foo <p>Some $bar</p> </div> MYUNIQUENAME;
You are simply going to love this one First of all, here is a sample table with data loaded: mysql> use junk Database changed mysql> drop table todd; Query OK, 0 rows affected (0.01 sec) mysql> create table todd (id int not null auto_increment,url VARCHAR(255), -> primary key (id)) ENGINE=MyISAM; Query OK, 0 rows affected … Read more
You could use sanitize_html_class() or sanitize_title_with_dashes(). Both functions do almost the same. But note that much more characters a valid in CSS class names. Examples: ✂ ✉ ✔✽ ✾ ✿ ❀ ❉ ❤ ❦ ☂ ☔ ☎ ☘ ♫ ♻ ⚥ Update I recommend to encapsulate the code in a prefixed function to avoid collisions … Read more
To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they’re all on. If you get them all back on and the content still … Read more
The initial solution I’ve found is to tie a filter onto an action like wp_insert_post_data and extract other post information from the global $post object. // Tack our filter onto the wp_insert_post_data action add_filter( ‘wp_insert_post_data’, ‘my_appender’ ); function my_appender( $content ) { // Bring global $post into scope global $post; // Get meta value of … Read more
$user_id = $this->_make_user(‘author’, ‘user_login_name’, ‘password’, ‘[email protected]’); wp_set_current_user( $user_id ); as long as the class that you define the testcase in inherits from WPTestCase, then you can use the _make_user function. The function is found in this svn repository, and is defined in wp-testlib/base.php line 380. NEW: I switched to using wp_insert_user. the following is in … Read more
Currently there are no ready filters available for this purpose. A ticket has been posted for the request.Lets hope we get one soon. Instead of hardcoding your custom post types its better to create a filter hook and use it Till then you can create your own filter. Open includes/class-wp-editor.php and make folowing changes at … Read more
The following does the job: add_action( ‘admin_init’,’wpse_60168_custom_menu_class’ ); function wpse_60168_custom_menu_class() { global $menu; foreach( $menu as $key => $value ) { if( ‘Posts’ == $value[0] ) $menu[$key][4] .= ” custom-class-1″; if( ‘Pages’ == $value[0] ) $menu[$key][4] .= ” custom-class-2″; } } And if you want to inspect what the $menu contains, use this: add_action( ‘admin_init’,’wpse_60168_var_dump_and_die’ … Read more
Do not use different callbacks, use the the sixth parameter for add_settings_field() instead. That is an array, and you can pass any data to the callback here. Example: foreach( $theOptions as $k => $v ) { add_settings_field( $k, $v, ‘my_callback’, $the_options, $the_group, array ( ‘special’ => $k ) ); } function my_callback( $args ) { … Read more
I use it including the file (Match you actual file location): require ‘../../FirePHPCore/fb.php’; and then call by using fb( $variable, ‘Message Title’); Be sure that you’ve installed and activated the FirePHP addon on Firefox. There’s also a WordPress plugin for FirePHP, but I’ve never used it.