Jump to content

Archived

This topic is now archived and is closed to further replies.

glennyboy

Title in WP Content/Loop

Recommended Posts

glennyboy    9
glennyboy

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
Simon    247
Simon

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

Share this post


Link to post
Share on other sites
glennyboy    9
glennyboy

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
Simon    247
Simon

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
glennyboy    9
glennyboy

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
glennyboy    9
glennyboy

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
glennyboy    9
glennyboy

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
Simon    247
Simon

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
glennyboy    9
glennyboy

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
glennyboy    9
glennyboy

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
Simon    247
Simon

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
glennyboy    9
glennyboy

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

Share this post


Link to post
Share on other sites
Simon    247
Simon

just install the pro plugin and turn it on.

Share this post


Link to post
Share on other sites

  • Similar Content

    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
    • flourishdesignstudio
      By flourishdesignstudio
      My DMS 2 site http://www.heart-stone.com/ will not save any new custom css... I can still edit templates and publish those but any custom css that I enter never saves.
      All WP files, themes, and plugins are up to date. 
      Any thought about what might be causing this?
    • flourishdesignstudio
      By flourishdesignstudio
      Is there a way to edit the custom CSS via FTP? I know I can edit the custom code in the Chrome editor but is there a file path I can use to find and edit the CSS directly from our FTP?
      Thanks in advance for the help!
    • nizami
      By nizami+
      Using navbar section with correctly configured WP menu to display main navigation at https://elenaangel.com. 
      All fine in desktop viewport. Menu displays twice in hamburger mode. How to fix this please? 

×