Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @gevcen

    You could do it easily with our Premium Templates extension by adding the code snippet below to the customizer custom styles:

    .order-date { display: none; }

    Alternatively you can use this action hook:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
        ?>
        .order-date { display: none; }
        <?php
    }

    If you never worked with filters/actions please read this documentation page: How to use filters

    Thread Starter gevcen

    (@gevcen)

    Dear,

    If I add your code in the Child Theme > functions.php, the site goes to failure. Please give me the code exactly as I can add into functions.php without the <?php> because this is already in the file.

    https://sgevcen.tinytake.com/tt/NDQwMzUwNF8xMzkxMjM4NQ

    Thanks

    Thread Starter gevcen

    (@gevcen)

    I tried to add this

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
        ?>
        .order-date { display: none; }
        <?php
    }

    and this too

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
        .order-date { display: none; }
    }

    but both brings failure on the site
    please give a correct code

    Thanks

    • This reply was modified 4 years, 9 months ago by gevcen.
    Plugin Contributor Ewout

    (@pomegranate)

    You need the top one, but you can only use it like that id you don’t already have a function with that name (wpo_wcpdf_custom_styles) otherwise you need to rename it:

    
    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles_2', 10, 2 );
    function wpo_wcpdf_custom_styles_2( $document_type, $document ) {
        ?>
        .order-date { display: none; }
        <?php
    }
    

    or avoid this altogether with an anonymous function:

    
    add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {
        ?>
        .order-date { display: none; }
        <?php
    }, 10, 2 );
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to hide a date field in the PDF ?’ is closed to new replies.