Functions file mods and CPU
Nope or Not really or Not noticeably.
Nope or Not really or Not noticeably.
“Headers already sent” means that some code tried to set a HTTP header (eg. to set a cookie), but that PHP already sent content that will end up in the HTML page. The most likely cause is that you added extra newlines after the ?> closing tag when you edited config.php or functions.php. The simple … Read more
You have multiple errors here. You’re including CSS and JS on the same and wrong hook For JS you could use wp_enqueue_scripts For CSS you could use wp_print_styles wp_register_script / wp_enqueue_script only accepts 4 parameters. You should only register your scripts and enqueue only the last one with its dependencies. Use the third parameter to … Read more
function btn($atts, $content = null) { extract(shortcode_atts(array(‘link’ => ‘#’, ‘color’ => ‘teal’ , ‘size’ => ‘large’), $atts)); return ‘<a class=”btn ‘.$size.'” href=”‘.$link.'” style=”background:’.$color.’;”><span>’ . do_shortcode($content) . ‘</span></a>’; } With that function you get by default color teal and size large. I suppose that for size you are using classess and for color just background. If … Read more
The excerpt must be used by the Theme. I don’t think it is. Use ‘the_content’ filter to append to the post. Excerpts are usually used in feeds and only by certain themes. add_filter(‘the_content’, function($content){ if(!is_archive()) return $content; global $post; // This is the current output post ob_start(); // Echo stuff to append to post here! … Read more
I do hope I understand what you’re asking, as you’re not giving much information. From what I specifically to customize the output of your comments. Well, there partially is. The wp_list_comments accepts a callback argument among several others. This callback allows you to run a custom function; in your case, a custom function to manipulate … Read more
functions.php file is where you can do wonders with your theme without touching the core WordPress files. Most of the time the backup functions.php trick would work for you unless you aren’t changing anything in the database with any of your action or filter hooks. You could check this link too -> http://codex.wordpress.org/Theme_Development#Functions_File Regarding the … Read more
Try this code, I’ve removed query_posts and used get_posts instead because I’m not sure if query_posts will work in a shortcode and using get_posts is safer. function featured() { $posts = get_posts(array(‘post_type’ => ‘property’, ‘posts_per_page’ => 2)); if(isset($posts) && !empty($posts)) { foreach($posts as $post) { echo “<div class=\”singlefeatured group\”>”; //I wasn’t sure what you wanted … Read more
The insideds of a function is separated from the global things. Therefore the variables, set by other processes are not reachable/useable inside a function until you made them so, with, for example global keyword for a var. So Add the_post(); after the function’s {, or add global $post; and use $post->ID instead of the_ID and … Read more
I think you need to use update_user_meta(), I may be misunderstanding what you’re trying to do though. EDIT (doesn’t work): add_action( ‘user_register’, ‘my_save_extra_fields’ ); function my_save_extra_fields( $user_id ) { update_user_meta( $user_id, ‘deposit’, 5 ); } EDIT: WORKING SOLUTION: add_action( ‘user_register’, ‘my_save_extra_fields’ ); function my_save_extra_fields( $user_id ) { global $wpdb; $cash=5; $wpdb->update( $wpdb->users, array(‘deposit’ => $cash), … Read more