Why isn’t my custom function kicking in from my functions.php file?

It isn’t working because you’ve mixed up returning values and echoing values updateToPerfectURLs(the_permalink()); Here updateToPerfectURLs returns its value, but you’ve not printed it out. Try echo/etc Your second problem is the opposite, the_permalink() doesn’t return the permalink, it echos it out. So before you’ve even gotten into the function the permalink is printed out. Use … Read more

Adding header function to theme

This code adds theme support for custom headers which adds a new page under Appearance in the wp dashboard. function themes_custom_header_setup() { add_theme_support( ‘custom-header’, $defaults, array( ‘default-text-color’ => ‘fff’, ‘width’ => 1260, ‘height’ => 240, ‘flex-height’ => true, ‘wp-head-callback’ => ‘themes_header_style’, ‘admin-head-callback’ => ‘themes_admin_header_style’, ‘admin-preview-callback’ => ‘themes_admin_header_image’, ) ) ); } add_action( ‘after_setup_theme’, ‘themes_custom_header_setup’ ); … Read more

Multiple URL from Custom post name

You can add a query var and a rewrite rule to handle the extra URL data- Add the wpd_cf query var to the list of known query vars: function wpd_add_query_var( $query_vars ){ $query_vars[] = ‘wpd_cf’; return $query_vars; } add_filter( ‘query_vars’, ‘wpd_add_query_var’ ); Add a rewrite rule to handle the incoming requests and set the wpd_cf … Read more

custom url with custom post

You can omit the “base”, by adding rewrite => array( slug => ‘item’, with_front => false, ), Don’t forget to flush your rewrite rules after you changed that. The easiest way to do so it to simply visit the “admin > settings > permalinks” page. If you need to add that to an already registered … Read more

Insert wordpress tags below posts via functions.php

If all you want to do is add tags to the post body without writing them into the theme templates, all you really need to do is: add_filter( ‘the_content’, function($content) { return $content.get_the_tag_list(); } ); See get_the_tag_list() for arguments. That, by the way, is basically what the the_tags() function does. However, there are other ways … Read more