Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2231167
how can i create the attachment.php file correctly
Closed

Comments

  • quartarolo started the conversation

    Hi friend, I really need your help. A very important function of my site is the function of page attachment.

    I read here in the forum, only 2 similar questions.
    how can i create the attachment.php file correctly

    The main idea I'm following is as follows,
    I take the single.php file and duplicate it, then rename it to attachment.php

    But in this file there is an instruction to get "<? Php get_template_part ('template-parts / content', 'single');?>”

    So I renamed the "single" part and changed it to attachment, while creating a new duplicate file from this one, named "content-attachment.php" from the "template-parts" folder.

    So this file is also pointing to another "$ single_style = $ single_style? $ Single_style: 'style-1';"
    Once again I duplicated the file “style-1” to “style-11” for example so that I could modify and place the code that makes the attachment image appear.

    But again arriving at the file "style-11" where in the part of appearing the content I am taken one more way.
    "get_template_part ('template-parts / single / entry-content');
    ?> ”
    so this seems to be the last file, because only google ads code appears there.

    I know my explanation is confusing. but deep down I can't put this default code that I use in other themes.
    <? php}?>
    <? php echo the_attachment_link (get_the_ID (), 'full'); ?>
    <? php
        $ id = (0); // ID of an attachment
        echo wp_get_attachment_link ($ id, '', false, false, '<h1> Click to download </h1>');
    ?>

    <? php the_content (); ?>

  •  501
    Penci replied

    Hi,

    if you want and or change code PenNews theme. I recommend you use child theme of PenNews theme.

    Please  send me your website managment information ( admin url site, username and password ) . We will take it a lock on this help you.

    Best Regards,

    PenciDesign

  •   quartarolo replied privately
  •  501
    Penci replied

    Hi,

    I can't login on your site. Please check it again


    Best Regards,

    PenciDesign

  •   quartarolo replied privately
  •  501
    Penci replied

    Hi,

    I checked on your site and custom  content-attachement.php help you as screenshot http://prntscr.com/q5upgdhttp://prntscr.com/q5upsw

    Please check it again.


    Best Regards,

    PenciDesign

  • quartarolo replied

    Thank you so much for your help, it exceeded all my expectations. it is perfect.
    I now believe that you can set this function as default in your theme.

    Thank you! your theme is fantastic