• (nodebb)

    PHP has an alternate syntax for blocks

    No, it doesn't. It has an alternative syntax for blocks. See e.g. https://www.php.net/manual/en/control-structures.alternative-syntax.php

    It's quite clearly an alternative syntax, both in the URL and the actual page of docs.

    Hmm. Apparently, the use of "alternate" to mean "alternative" is a strong Americanism. I suppose I could be persuaded to forgive you... ;)

  • And yet it runs (unregistered)

    Looks like the colon syntax is meant for when you mix your PHP with HTML, just to make it easier to read.

    <?php if ($condition): ?>
        <p>Content shown if true</p>
    <?php elseif ($other_condition): ?>
        <p>Content shown if other is true</p>
    <?php else: ?>
        <p>Content shown otherwise</p>
    <?php endif; ?>
    

    Also note that you have to use elseif instead of else if when using colon syntax.

  • Smithers (unregistered)

    meaning we get four months of January, which just seems cruel, honestly, at least in the Northern Hemisphere.

    We're getting them in place of October-December, so it's not like we're missing summer or anything. Honestly just skipping the slow descent through autumn and getting straight into the thick of winter might not be a bad thing. Only downside I see is Christmas... no, not skipping it: Russian Christmas is in January, so this way you have to go through that rigmarole four times in a row! (NB I have not checked whether those months are actually Russian or another language with the Cyrillic alphabet.)

  • Rhailto101 (unregistered)

    Method get_the_date() is not a Core PHP Method. It is from "WordPress Developers Resources" (url: ...//developer.wordpress.org/reference/functions/get_the_date/).

    Admittedly WordPress is a PHP Application but, despite the pervasive meme that "PHP is bad", it is not PHP's fault. For your convenience (and it should have been referenced in the Article to give the Judgement some credence), The Method is:

    function get_the_date( $format = '', $post = null ) { $post = get_post( $post );

    if ( ! $post ) {
    	return false;
    }
    
    $_format = ! empty( $format ) ? $format : get_option( 'date_format' );
    
    $the_date = get_post_time( $_format, false, $post, true );
    
    /**
     * Filters the date of the post.
     *
     * @since 3.0.0
     *
     * @param string|int $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
     * @param string     $format   PHP date format.
     * @param WP_Post    $post     The post object.
     */
    return apply_filters( 'get_the_date', $the_date, $format, $post );
    

    }

    The "warthog" in me could not find the will to explore further. I.e. track down the other "methods" invoked.

  • f222 (unregistered) in reply to Smithers

    They effectively do look like Russian but in feminine form. Don't know if it's another WTF or a country dependent thing though 🤔

  • Wordpress devs anonymous (unregistered) in reply to Steve_The_Cynic
    Comment held for moderation.
  • no (unregistered) in reply to f222
    Comment held for moderation.
  • (nodebb) in reply to Smithers

    We're getting them in place of October-December, so it's not like we're missing summer or anything. Honestly just skipping the slow descent through autumn and getting straight into the thick of winter might not be a bad thing.

    Heretic. Blasphemer. Autumn is infinitely superior to all other seasons. None of the other seasons have Halloween, for example. Or Thanksgiving. Okay, I'm clearly American, so you've tuned out already. Bye.

  • (nodebb) in reply to f222

    They are in the genitive case, which is proper when used within a date. However in that case, they should not be capitalized, which the array values seemed to be. So still one more oddity.

    Anyway, the entire thing looks like new code that the next intern will get to debug next Winter.

    Also, if you google 'php convert date', it only takes a few seconds to find at least one example which suggest a regex is the best way to do this, instead of, you know, using internal functions already present to scan dates. Because clearly library date functions have to be slower then making your own. One can never trust libraries.

  • (nodebb) in reply to f222

    They effectively do look like Russian but in feminine form.

    Russian months don't have a feminine form. That's the genitive case, which you use when talking about a date with a day of month. For example, 1 января means January 1.

  • COBOL Dilettante (unregistered)

    Maybe the writer is among the oldest of Old Calendarists, and rejects the 12-month innovation of the Julian reforms

Leave a comment on “Blocked the Date”

Log In or post as a guest

Replying to comment #699701:

« Return to Article