How to divide and display categories into two columns

You don’t need any code changes to your PHP or html! Assuming the following code was used: <ul class=”mypagelist”> <?php wp_list_pages(‘sort_column=menu_order&title_li=’); ?> </ul> Resulting in: <ul class=”mypagelist”> <li>Page 1</li> <li>Page 2</li> <li>Page 3</li> <li>Page 4 <ul> <li>Subpage 1</li> </ul> </li> <li>Page 5</li> </ul> Use CSS along the following lines: .mypagelist { width:600px; /* or any … Read more

How to add class or id to shortcode HTML elements?

You could abandon the shortcodes and use HTML. <div class=”row full-width whatever”> [one_third]1[/one_third] [one_third]2[/one_third] [one_third]3[/one_third] </div> OR you could easily just wrap all of your code in another div and target the [row] element through CSS: <div class=”your_special_wrapper”> [row] [one_third]1[/one_third] [one_third]2[/one_third] [one_third]3[/one_third] [/row] </div> <style> .your_special_wrapper div{ /*whatever css you need*/ } </style>

Adding HTML tags or css classes to admin columns

Here’s what I ending up using thanks to Milo, the Codex and this post from http://simple2kx.com/. add_action( ‘manage_issues_pm_posts_custom_column’, ‘my_manage_issues_pm_columns’, 10, 2 ); function my_manage_issues_pm_columns( $column, $post_id ) { global $post; switch( $column ) { /* If displaying the ‘issues_type’ column. */ case ‘issues_type’ : if ( $terms = get_terms( ‘issues_type’ ) ) { echo ‘<span>’; … Read more

Advanced Custom Fields: Sorting custom columns with custom fields sorts only by date

It appeared it was due to the fact that WordPress doesn’t understand that you need to order by certain post meta unless you specify it. So in my case adding this fixed the sorting issue: add_action( ‘pre_get_posts’, ‘custom_orderby’ ); function custom_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); if( ‘featured’ … Read more

User sort by role administrator area

Add this code to functions.php of your current theme ( preferably, child theme ): function wpse_user_sortable_columns($columns) { $columns[‘role’] = ‘role’; return $columns; } add_filter(‘manage_users_sortable_columns’, ‘wpse_user_sortable_columns’); This will change Role column to be sortable.

Check if column exists for one table in DB

I found this solution : here So… class MainClassAddon{ public function __construct(){ register_activation_hook( __FILE__, array( $this, ‘install’ ) ); } public function install(){ $row = $wpdb->get_results( “SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name=”wp_t” AND column_name=”c”” ); if(empty($row)){ $wpdb->query(“ALTER TABLE wp_t ADD c INT(1) NOT NULL DEFAULT 1”); } } } new MainClassAddon(); register_uninstall_hook( __FILE__, array( ‘PluginNamespace\MainClassAddon’, … Read more

Admin multiple column sorting

Since WordPress already allows for the sorting of page titles alphabetically (either ascending or descending order), all that is actually needed is to add an Author filter. This can be achieved by adding the following to the functions.php file of your active theme: function rudr_filter_by_the_author() { $params = array( ‘name’ => ‘author’, // this is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)