Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter unconquered

    (@unconquered)

    Edit: Nevermind, it conflicts with another plugin ReCaptcha. Seems to be working after I deactivated NoCaptcha ReCaptcha.

    Thread Starter unconquered

    (@unconquered)

    EDIT: The above doesn’t link to the size specific attachment, instead it displays the size specific attachment and links to the full size.

    I ended up going with wp_get_attachment_image_src()

    <?php $the_image_link= wp_get_attachment_image_src( get_the_ID(), 'mycustomsize' ); ?>
    Custom Size :<a href="<?php $the_image_link[0]; ?>"> View </a>

    It seems to again link to the fullsize/default stuff again

    EDIT Fixed.
    It seems to work when done in one go:

    <?php $the_image= wp_get_attachment_image_src( get_the_ID(), 'myCustomsize' );
    		$img_size_url=$the_image[0];
    echo '<a href='.$img_size_url.'>View Custom size</a>'; ?>
    • This reply was modified 7 years, 9 months ago by unconquered.
    • This reply was modified 7 years, 9 months ago by unconquered.
    • This reply was modified 7 years, 9 months ago by unconquered.
    Thread Starter unconquered

    (@unconquered)

    @howdy_mcgee thanks a lot! that’s exactly the function I was looking for. To be specific

    echo wp_get_attachment_link( $id, '' , false, false, 'My link text' );

    Works perfect, and call the attachment id using get_the_ID();

    echo wp_get_attachment_link( get_the_ID(), '' , false, false, 'My link text' );

    Above is the solution, thanks again @howdy_mcgee

    Thread Starter unconquered

    (@unconquered)

    @karpstucking thank you, never knew about srcset, I learned something new. However srcset looks impossible when my theme is using <?php the_post_thumbnail() ?>

    Thread Starter unconquered

    (@unconquered)

    @keesiemeijer
    Works like a charm, thank you so much for your time!. I have very basic knowledge of backend and server side scripting. I will keep reading through your code and try to learn. To be honest, it really looks complicated

    btw:
    consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.

    This is exactly what I do, I have a plugin php made and theme is no issue as I use a custom one that I made.

    Thread Starter unconquered

    (@unconquered)

    Yes the users will use the shortcode, most don’t know html or won’t even bother learning the img tag and I rather not task them

    Thread Starter unconquered

    (@unconquered)

    Hi Kessiemeijer, Yes it’s set to automatically published. I am also automating the shortcode to pull the thumbnail along with the video i.e telling it to read videoname.mp4 and replace mp4 with _thumb.jpg then place <video><source sr......</video> </br> <img src="video_thumb.jpg> The img part is done in hopes of the auto post plugin to pick it up.

    However I am assuming the Autopost plugin scans the post before the shortcode is executed, hence it’s not detecting an image

    Hey I had the exact same problem and saw the previous thread. Yes it gets rid of the entire thing. I’m not too familiar with php and there could be 100 better ways to solve this. Here is what I did

    open the plugins/bbpress-multi-image-uploader/Includes/Common/function.php

    Now search for

    if( !empty( $attachments ) ) { ?>
    
    <div class="shr-reply-attach"><?php
    foreach( $attachments as $attachment ) {
    $attach = wp_get_attachment_image_src( $attachment->ID , 'thumbnail' );
    $attach_full  = wp_get_attachment_image_src( $attachment->ID, 'full' ); ?>
    <a href="<?php echo $attach_full[0]; ?>" class="thickbox bbp-uploader-thumb">
    <img src="<?php echo $attach[0] ?>" alt="<?php echo $attachment->post_name; ?>" />

    Right under it you’ll see <span><?php echo basename( pathinfo( $attach_full[0], PATHINFO_FILENAME ) ) ?></span>
    Delete this entire line. Or you can also comment it if you want to save it for later use
    (note if you use an editor it will be line number 224)

    Also note that entire section is where you can style the attachments with CSS

    • This reply was modified 8 years, 2 months ago by unconquered.
    • This reply was modified 8 years, 2 months ago by unconquered.
    • This reply was modified 8 years, 2 months ago by unconquered.
Viewing 8 replies - 1 through 8 (of 8 total)