• Resolved tceriksen

    (@tceriksen)


    Hi,

    I am trying to create a custom recipe builder from a single.php template.
    I’ve copied the single.php from my main theme (Salient from Themenectar) and pasted it in my child theme and modified it with Advanced Custom Fields and disabled the general WYSIWYG textarea from within ACF. I don’t know where to put the print-icon. Should I create a text field and place the print-o-matic shortcode there or is there a better/smarter way?

    BR, Thomas Eriksen

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    If the question is how to place a shortcode in a php template, check out WordPress’ do_shortcode function.

    Thread Starter tceriksen

    (@tceriksen)

    Hi Twinpictures.

    Thanks for the quick response. I’m rather new to customising WP with shortcodes etc. so my questions might appear rather green or naive.

    I entered echo do_shortcode(‘[print-me]’); before the last </div> in the hopes that it would include all the content within the divs, when I press the print button, but it only prepares the featured image and two tags. Nothing else. I’ve looked through the print-o-matic documentation and tried to google my desire without a clue.

    Can you point me to some instructions or offer any other help?
    BR Thomas

    Plugin Contributor twinpictures

    (@twinpictures)

    sure, here is the documentation:
    https://plugins.twinpictures.de/plugins/print-o-matic/documentation/

    So, now that you have the shortcode showing up in your template, you need to tell it what target to print. it will not automatically print the element that contains the shortcode, but rather it uses the target attribute (or if non is given, the target defined in the plugin settings).

    If the container that should be printed has a unique ID or CLASS, this can be used to target the print as described in the docs.

    Thread Starter tceriksen

    (@tceriksen)

    Excellent. So easy with the class attribute. Thanks!

    Everything shows up now except the images within.

    I’ve used this code to pull the image from the custom field and into the variable $billede1

    if (get_field (‘billede1’) ) {
    $billede1 = get_field(‘billede1’);
    }

    <div class=”opskrift_billede1″>
    “>
    </div>

    Is it the wrong way to do it in order for the system to process the image?
    The image appears in the new browser tab that opens when I click the print button, but not in the print preview.

    Thanks in advance!

    • This reply was modified 5 years ago by tceriksen.
    • This reply was modified 5 years ago by tceriksen.
    Thread Starter tceriksen

    (@tceriksen)

    I switched on the Use Theme CSS For Print Page feature and the images appeared.

    Plugin Contributor twinpictures

    (@twinpictures)

    Not sure about that code.
    can you share a link to the page in question?
    If the images are not printing, it might be the print is being triggered with out enough pause before print to allow the images to laod.
    again, a link would help with troubleshooting.
    also, uncheck close window after print to see if the images do load eventually.

    Plugin Contributor twinpictures

    (@twinpictures)

    ah, good. so issue is resolved then.

    Thread Starter tceriksen

    (@tceriksen)

    Well yes, but now I see that icons (Font Awesome used: <i class=”fa fa-clock-o”>) are not showing in the print preview.

    Plugin Contributor twinpictures

    (@twinpictures)

    depends on how your theme is loading the font-awesome css.
    normally you just need to manually include the <link> to that css file in the print page header or footer (plugin settings page).

    look at the display page’s source code and search for the html that is loading the font awesome css. copy that and paste it in the HTML header area of the plugin settings.

    Thread Starter tceriksen

    (@tceriksen)

    This plugin is really flexible :). Awesome.

    I missed your post about a link to the page.

    It’s on a development domain:

    https://stenstruplund.webshop-hjemmeside.dk/2020/03/squash-frikadeller/

    Right now all that is “missing” or acting autonomous is the time icon and people icon and their text that is having a line break in the print preview, but not in the print display page.

    It’s just a detail but I’d like to know whats going on.

    Thanks in advance!

    Plugin Contributor twinpictures

    (@twinpictures)

    OK. So looking at the source, the link to font-awesome is as follows:

    <link rel='stylesheet' id='font-awesome-css' href='https://stenstruplund.webshop-hjemmeside.dk/wp-content/themes/salient/css/font-awesome.min.css?ver=4.6.4' type='text/css' media='all' />

    This needs to be included on the print page. use the print options page and paste that code in the HTML top section.

    Also, provide a bit more pause before print time so the images are sure to print.

    Good looking page, by the way.

    Thread Starter tceriksen

    (@tceriksen)

    Voila! I had that link tag at the right place, but after putting the pause before print it all seemed to sort out.

    Thanks a lot. 5$ going your way.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Usage with Advanced Custom Fields’ is closed to new replies.