• 0

DMS 2 Title in WP Content/Loop


Question

Posted · Report post

Hi

 

The WP Content/Loop doesn't include the ability to have a post / page title without legacy mode. Given that legacy mode is apparently not supported in future releases and therefore to be avoided for sites that you want to last this seems extremely odd. Right now I'm having to use a hack of Wordpress title as short code in the Standard Title field or an additional php in PLNextBox.

 

Please advise of workaround or put this obviously necessary feature back into the non-leagcy element.

 

Glennyboy

Share this post


Link to post
Share on other sites

13 answers to this question

  • 0

Posted · Report post

Easy..

 

1. Enable action map in pro tools..

2. locate the action we want to use https://cloudup.com/cefHbgfFmj1 

3. We'll use pagelines_before_postloop for this example.

 

The code:

 

add_action( 'pagelines_before_postloop', 'my_title_function' );

function my_title_function() {

    global $post;
    if( is_single() || is_page() ) { 
        printf( '<h1>%s</h1>', $post->post_title );
    } 
}

 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Use a wp action to add your title to wherever you like?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Ok so let's say I want to add the title at the top of my WP Content/Loop section with surrounding h1 tags. What would the code be please?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

awesome @Simon_P 

 

Is there a repository of these hooks? if not there really should be .....

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Simon_P any way to insert the title physically into the post loop (prepend). Currently its before the post loop and that means it loses the padding classes as layout of the postloop section

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

not to worry got it with:-

 

pagelines_before_XXX
pagelines_after_XXX
pagelines_inside_top_XXX
pagelines_inside_bottom_XXX

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

not to worry got it with:-

 

pagelines_before_XXX
pagelines_after_XXX
pagelines_inside_top_XXX
pagelines_inside_bottom_XXX

exactly 

 

action map ;)

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Top man

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi Simon_P

 

How can I extend this so a title also appears in repeated regions such as post / category achieves. I've tried a number of conditional statements (is_archive() etc) and am currently trying :-

if( is_singular('post') || is_main_query() ) {

problem is that it only outputs the title once at the top of the archive.

 

Thanks

Glennyboy

 

 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Seems this is more an issue with repeating regions. The hook only adds to the first section in the loop - any way around this?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Then you will need a different action area, try a different one from actionmap. Or add more actions.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

How can I see the flu;l action map locations?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

just install the pro plugin and turn it on.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now