3Comentarios

  • Eh Jewel

    13 de octubre de 2020

    Note that get_the_content doesn’t return the same thing as what the_content displays. For that you need to do this:

    $content = apply_filters( \'the_content\', get_the_content() );
    echo $content;
    
    Responder
    • Demo User

      13 de octubre de 2020

      If you are wanting to check if a custom (non core block) is for a page or post, include the namespace/name-of-block:

      if ( has_block( \'my-namespace/block-name\' ) ) {
       // Do stuff here.
      }
      
      Responder
  • Eh Jewel

    13 de octubre de 2020
    // Note: does not support arrays
    if ( has_block( array( \'gallery\', \'button\' ) ) ) {
        // error
    }
     
    // Use || instead
    if ( has_block( \'gallery\' ) || has_block( \'button\' ) ) {
        // Do something.
    }
    
    Responder

Deja un comentario

Share this Doc

Accordions Widget

Or copy link

CONTENTS
Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot Avatar
What can I help you with?