• Resolved Yolanda

    (@locovip)


    I want to add the single post title function to this code:

    function wpcol_one_third ($atts, $content = null) {
    
    			return '<div' . $this->wpcol_div_atts($atts,'wpcol-one-third') . '>'.$this->wpcol_strip_autop($content).'</div>';
    
    		}
    
    		function wpcol_one_third_end($atts, $content = null) {
    
    		  return '<div' . $this->wpcol_div_atts($atts,'wpcol-one-third wpcol-last') . '>'.$this->wpcol_strip_autop($content).'</div>'.$this->wpcol_add_divider();
    
    		}

    It consists of a plugin that works with columns. I need that it gets the default single post title code to show it inside the provided code.
    Is that possible? Help me please!

    Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • the post title would possibly be accessible by:

    global $post; $posttitle = apply_filters('the_title',$post->post_title);

    but where exactly do you want the title to show in the final column layout?

    Thread Starter Yolanda

    (@locovip)

    Thank you alchymyth for the quick reply!
    Yes I wanted to show the post title on top of the one_third column.
    For now I have writted (the title post) manually as you can see in
    http://maggyvillarroel.com/adsos/

    but my initial idea was to implement the php changes to implement the post title so I will try your solution even I don’t know exactly where should add your provided code.

    Thank you very much again,alchymyth.

    Kind regards

    as you are adding the title to the last third column, you could try to add it here:

    function wpcol_one_third_end($atts, $content = null) {
    
    		  return '<div' . $this->wpcol_div_atts($atts,'wpcol-one-third wpcol-last') . '>'.$this->wpcol_strip_autop($content).'</div>'.$this->wpcol_add_divider();
    
    		}

    like so (untested):

    function wpcol_one_third_end($atts, $content = null) {
    global $post;
    		  return '<div' . $this->wpcol_div_atts($atts,'wpcol-one-third wpcol-last') .'><h1><strong>'.apply_filters('the_title',$post->post_title).'</strong></h1>'.$this->wpcol_strip_autop($content).'</div>'.$this->wpcol_add_divider();
    
    		}

    details might depend on the general coding of the theme.
    what theme are you using?

    Thread Starter Yolanda

    (@locovip)

    It worked like a charm!
    The only thing is that the post title repeats in every one_third column…although the “hack” worked, I think would be better to add the Title manually, just takes a little bit of time and doesn’t repeat in every one_third column.
    I will take into consideration the code you provided here for “maybe” implement it in the future if the site needs, it’s very useful.

    Thank a lot once again and kind regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help me adding post title inside this code’ is closed to new replies.