How can I order metaboxes in my posts in WordPress?

<?php $ck = get_post_custom_keys($post_id); //Array foreach ($ck as $k) { if (substr ($k, 0, 1) == ‘_’) { // skip keys starting with ‘_’ continue; } $cv = get_post_custom_values($k, $post_id ); //Array foreach ($cv as $c) { if (empty ($c)) { // skip empty value continue; } echo ($k . ‘: ‘ . $c . … Read more

Show one same template for two category

You can do it in many ways. Two solutions I recommend are: 1. Editing category template Just edit your category.php template and put if statement in there: if ( is_category( array(15, 19) ) ) get_template_part(‘category-15-19’); else get_template_part(‘category-all’) Then just put code for category 15 and 19 into category-15-19.php file and code for other categories into … Read more

enqueue script if page is not equal to

add_action( ‘wp_enqueue_scripts’, ‘ron_scripts’ ); function ron_scripts(){ if(is_home()){ wp_register_script( ‘homescript’, ‘/wp-content/themes/template/js/menu-home-open.js’ ); wp_enqueue_script( ‘homescript’ ); } else { wp_register_script( ‘nothomescript’, ‘/wp-content/themes/template/js/FILENAMEHERE.js’ ); wp_enqueue_script( ‘nothomescript’ ); } } alternatively replace is_home(); with any other method or code that determines what page you are on. ex: might work if(site_url() == get_permalink()){ //do home stuff } else { //do … Read more

Load code for custom fields only on admin pages?

Loading this code won’t have big impact on loading times. Of course you should make sure, that this code is only executed when it should be… But yes, it should be possible. Just make sure you don’t use it to early (when is_admin() return incorrect value). EDIT The code you’ve posted here should work just … Read more

Problem with registration page

The problem was the mod_rewrite of Apache. I went in /etc/apache2/sites-available/000-default and I changed Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all to Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all the I restarted the apache server and all gone fine.

WYSIWYG with HTML source?

Why not automate the move from Drupal to WP? I think WP will fix some of the P tag issue during the upload. http://codex.wordpress.org/Importing_Content#Drupal If that isn’t an option, I think WP is using br’s instead of full new p. From the visual editor, I’d delete the copied break altogether and “enter” a new one.