• Resolved dynamitri

    (@dynamitri)


    Hi all,

    I am having a problem with the get_the_date() function on my WordPress, at http://www.dynamitri.pl. After hours of investigation and working through trial and error I have pretty much narrowed it down to the issue being a problem with get_the_date() rather than anything else.

    I have slightly amended a part of my utility.php file, and went from:

    /** Prana Post Date */
    function prana_post_date() {
    
    	$post_date = esc_html( get_the_date() ) . " " . esc_attr( get_the_time() );
    
    	/** Output */
    	$output = sprintf( '<span class="entry-date" title="%1$s"><a href="%2$s" title="%3$s" rel="bookmark">%1$s</a></span>', $post_date, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) );
    	return $output;
    
    }

    to

    /** Prana Post Date */
    function prana_post_date() {
    
    $post_date = esc_html ( get_the_date() ) . ( prana_entry_meta_sep() );	
    
    	/** Output */
    	$output = sprintf( '<span class="entry-date" title="%1$s"><a href="%2$s" title="%3$s" rel="bookmark">%1$s</a></span>', $post_date, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) );
    	return $output;
    
    }

    What I wanted to achieve is

    a) getting rid of the timestamp (as don’t really need it), and
    b) having the date followed by the backslash metadata separator (triggered by the prana_entry_meta_sep() function).

    I have achieved my aim in 50%, as evidenced on http://www.dynamitri.pl. I have the metadata separator after the date. However, for some reason, as soon as I placed the prana_entry_meta_sep() function in an appropriate place for it to show up where intended, some code has cropped up that precedes the date. Code that I cannot get rid of no matter how hard I try, without reducing the site to the point of giving me syntax errors. What happens right now is the date is preceded by three characters:

    \ ">

    Oddly enough, they are not hyperlinked to anything (the date itself is). I went through all the .php files in my WordPress editor (not all of those on the server, mind you – didn’t get down to that yet). I’ve searched for those three characters – no results there. Searched through the utility.php file that I have altered, hoping to find those 3 mysterious chars there. Again, no result.

    At some point, however, I have attempted to insert get_the_date() to the bottom of my post (the code of which is in the content.php file), and, alas, it appeared with \"> at the very beginning there as well. This has made me almost 100% certain that it’s get_the_date() that’s causing some issues suddenly. What is going on in there and why, however, I have no idea.

    All suggestions as to what could be done to sort this issue out would be really appreciated, seeing I have spent the better part of yesterday (and today so far) on trying to work out what is causing the problem to no avail. Slowly running out of ideas here. Maybe some fresh outlook, and a mindset not fatigued by racking their brains for hours no end, will be able to help. Many thanks!

    Best,

    Dynamitri

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with get_the_date() function’ is closed to new replies.