Custom field values in permalink

Here’s how I’d do it. I’m just going to say, I haven’t tested this code at all, so I don’t know if it even works. It’s more of a starting point for you. function jpb_custom_meta_permalink( $link, $post ){ $post_meta = get_post_meta( $post->ID, ‘<insert your meta key here>’, true ); if( empty( $post_meta ) || !is_string( … Read more

Custom Post Type with Custom Title

You can try the following code. function custom_post_type_title ( $post_id ) { global $wpdb; if ( get_post_type( $post_id ) == ‘cars’ ) { $engine=”, “.get_post_meta($post_id, ‘Engine’, true).’l’; $terms = wp_get_object_terms($post_id, ‘brand’); $abrand= ‘ ‘.$terms[0]->name; $amodel=” “.$terms[1]->name; $title = $post_id.$abrand.$amodel.$engine; $where = array( ‘ID’ => $post_id ); $wpdb->update( $wpdb->posts, array( ‘post_title’ => $title ), $where ); … Read more

Highlighting Sub topic in a post?

But am looking for a plugin or a code which can help me with adding this note every time I write a post. A shortcode to add that “note” is trivial. function note_sc_wpse_107275($atts,$content) { return ‘<p class=”note”><strong>’.$content.'</strong></p>’; } add_shortcode(‘note’,’note_sc_wpse_107275′); Then just add [note]Note content[/note] to your post body. That will give you exactly what you … Read more

How can I disable parent menu item links?

Do not create fake URLs (#). This would be very bad for users with a screen reader: the are using a list of available links to browse your site. The same is true for javascript: links, they are not exactly elegant markup anyway. You need two steps: Mark the items with children before the walker … Read more

Using WordPress functions on other sites

You could simply include the WordPress main file that it loads, wp-load.php or wp-blog-header.php at the very top of your forum’s header file. If I’m correct, that should allow you to use WordPress functions inside your forum theme. Example, at the top of your header, assuming the forum folder is in the root WP folder: … Read more