[Resolved] Instal date/time

Home Forums Support Instal date/time

Viewing 15 posts - 1 through 15 (of 37 total)
  • Author
    Posts
  • #1286067
    JOAQUIM GALANTE

    I am use the pluginception and when i activate the code below said ‘Fatal Error’

    add_shortcode( ‘custom_date’, function() {
    $time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>%2$s</time>’;

    if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) {
    $time_string .= ‘<time class=”updated” datetime=”%3$s” itemprop=”dateModified” style=”display:none;”>%4$s</time>’;
    }

    $time_string = sprintf( $time_string,
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_attr( get_the_modified_date( ‘c’ ) ),
    esc_html( get_the_modified_date() )
    );

    $date = sprintf( ‘%3$s‘,
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    $time_string
    );

    return $date;
    } );

    How can i solve the problem ?

    #1286137
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try the Code Snippets plugin as David suggested several times here?
    https://generatepress.com/forums/topic/some-improvements-if-possible/#post-1285477

    I just tested the code and it works.

    #1286149
    JOAQUIM GALANTE

    Yes, David told me that but once i installed this program and i puted the code when activated i need to recover the site because a fatal error appear, since then always i install the Code Snippets plugin and activate it a fatal error occurs.

    I use Pluginception and in this plugin the code give a ‘Fatal error’ when active.

    #1286151
    Leo
    Staff
    Customer Support

    Pluginception is not what you want to use.

    Can you disable that for now?

    Have you added anything else within CodeSnippets?

    The plugin by itself cannot cause a fatal error. We use it ourselves and lots of users are using it as well.

    #1286156
    JOAQUIM GALANTE

    With Pluginception i have 2 plugins about the features grid and function very well.

    I am affraid to install code snippets because when i go activated the plugin imediately occur a ‘Fatal Error’

    #1286163
    JOAQUIM GALANTE

    One time i add a code send by Tom in codesnippets i made some changes in code (because the code didn´t function) and did a ‘Fatal Error’ i resolve the problem and desactivate and uninstall de plugin.

    One hour later more or less i resolve to install again (codesnippets) and when activate the plugin imediatly wp advise ‘Fatal Error’.

    #1286166
    Leo
    Staff
    Customer Support

    Then try function.php of a child theme:
    Adding PHP: https://docs.generatepress.com/article/adding-php/

    I’m not sure what you are using Pluginception for but it sounds overkill for what you need.

    Code Snippets or function.php would be the better choice.

    #1286170
    JOAQUIM GALANTE

    I use pluginception because snippets give a fatal error and in that link https://docs.generatepress.com/article/adding-php/ pluginception is the second option.

    #1286176
    Leo
    Staff
    Customer Support

    Take a look at the

    How can I recover my site if it is crashed by a buggy snippet?

    or

    Can the plugin be completely uninstalled

    https://en-ca.wordpress.org/plugins/code-snippets/

    #1286177
    JOAQUIM GALANTE

    Ok, tell me have a trouble if the pluginception and codesnippets are both active ?

    #1286179
    Leo
    Staff
    Customer Support

    It shouldn’t be. But it’s best to fix the Code Snippets using one of the methods I mentioned above.

    #1286192
    JOAQUIM GALANTE

    Thanks, when the Fatal error occurs the wp automatcaly put in the safe mode and i delete the plugin.

    Now, I already install the snippets but i am affraid to activate it my aknowledge is poor and if i have a seriously problem i don´t know how to solve the problem and i lost the site. 🙂

    Thanks a lot.

    #1286204
    Leo
    Staff
    Customer Support

    So is the Code Snippets plugin activated now?

    If so you just want to make sure the copy and paste this code exactly then you should be fine:
    https://generatepress.com/forums/topic/shortcode-for-current-date/#post-632065

    Please don’t modify the code.

    #1286215
    JOAQUIM GALANTE

    When activate the Code Snippets look what happend.

    An easy, clean and simple way to run code snippets on your site. No need to edit to your theme’s functions.php file again!

    Versão 2.14.0 | Por Code Snippets Pro | Detailes
    This plugin failed on charge and it is suspended during the recuperation mode.

    An error type E_COMPILE_ERROR caused in line 7 of file /home/oe3pog5g/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code. Error Message: Cannot redeclare my_function_for_excluding_posts() (previously declared in /home/oe3pog5g/public_html/wp-content/plugins/magazinegridfrontpage/magazinegridfrontpage.php:12)

    #1286220
    Leo
    Staff
    Customer Support

    Can you disable plugin magazinegridfrontpage?

    Or remove all existing snippets in Code Snippets?

Viewing 15 posts - 1 through 15 (of 37 total)
  • You must be logged in to reply to this topic.