Insert Message before content of after title

You need to use ‘the_content‘ filter function add_before_content($content) { return ‘Before content area ‘.$content; } add_filter(‘the_content’, add_before_content); It will still be inside the content div. If you want it outside the div you have to edit related template files i.e. single.php or templates/content-single.php. It all depends on which pages you want to apply it.

How to I make my post title link to a custom field

I assume that the post title markup looks something like so: <h1><a href=”https://wordpress.stackexchange.com/questions/117332/<?php the_permalink(); ?>”><?php the_title(); ?></a></h1> You merely need to replace <?php the_permalink(); ?> with your post custom meta value: <?php $post_bookmark = get_post_meta( get_the_ID(), ‘post_bookmark_url’, true ); ?> <h1><a href=”https://wordpress.stackexchange.com/questions/117332/<?php echo $post_bookarmk; ?>”><?php the_title(); ?></a></h1> Other caveats: You’ll want to consider the context … Read more

how to remove the default title of Categories widget

There is a filter you can use to do this. (Kruti has even found it, but instead of using it, he modified core files…) $title = apply_filters(‘widget_title’, empty( $instance[‘title’] ) ? __( ‘Categories’ ) : $instance[‘title’], $instance, $this->id_base); So what you really need to do, is to add this to your functions.php: function my_repair_categories_empty_title($title, $instance, … Read more

Output menu title

This outputs the title of a menu using wp_get_nav_menu_object (and prepends to the Content). function pg_show_nav_menu_title ( $content ) { // ID of the menu you want $nav_menu_id = 14; //Get menu into an object $nav_menu_object = wp_get_nav_menu_object( $nav_menu_id ); //Get the name (title) $nav_menu_title = $nav_menu_object->name; //String to return as Content $content=”Nav menu title: … Read more

Create a list of posts with topic headdings

OK I got it working. Not sure if it is the best way but I thought I would add a reply anyway. Set up the information needed for the custom loop using $args = array As described in http://codex.wordpress.org/Class_Reference/WP_Query $args = array( ‘post_type’ => ‘product’, ‘meta_key’ => ‘wpcf-topic’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ … Read more

How to remove Title and CSS styling of title from particular page

The body_class() (see Codex) is a function that displays classes depending on the query. In other words: Depending on where you are, it outputs different classes. You can as well append your own – either directly as argument or with a filter: // Directly in your template <body <?php body_class( ‘your-custom-class-name’ ); ?>> Example for … Read more

How to get links to the last N posts in a specific category?

First, there is no parameter named cat in get_posts. Use category instead to input comma separated category IDs or category_name to directly inserting category name. Second, in your code you have commented out the title of the post. Try this code. <?php $cat_id = get_cat_ID(‘category1’); $posts = get_posts( “category=$cat_id&posts_per_page=3” ); if ($posts) { foreach ($posts … Read more

Echo title with permalink

This is the problem: $link = the_permalink(); Replace it with: $link = get_permalink(); Notice that the WordPress the_* functions will echo the output, but get_* will return it. But of course there are exceptions to this rule 😉 So you don’t need this: echo the_title(); Just use this instead: the_title(); or the usage example given … Read more

How to show show the Second page title in the page

get_post_ancestors() returns all of the ancestors hierarchically. As you only want to display the 2nd level post title on 4th post page, you can do something like – global $post; $parents = get_post_ancestors( get_the_ID() ); if( count($parents) == 4 ){ // ancestor1 = 1st parent, ancestor2 = second. echo get_the_title($parents[‘1’]); // index starts from 0, … Read more