• Resolved dinkybluebug

    (@dinkybluebug)


    Hi.

    Can anyone tell me what I need to do so that when a user uploads an image into their post, and it automatically adds in a at the end of the image. At the moment, the cursor disappears because it is right next to the inserted image, and I think it would look neater.

    Any ideas?
    Many thanks

    https://wordpress.org/plugins/wp-user-frontend/

Viewing 6 replies - 1 through 6 (of 6 total)
  • are you talking about the way attachments have no style?
    I tried css but to get a normal list output I also had to insert </br> after each li </span> in wp-user-frontend/wpuf-functions.php.

    Thread Starter dinkybluebug

    (@dinkybluebug)

    Sorry. Just read my post back and it doesn’t make any sense as the code has been removed

    I’d like a line break to be added in automatically after an image when an image is added into a post using the ‘add image’ button. At the moment it isn’t clear when the cursor is as it located buttom right of the image and isn’t obvious where it is. Meaning you try and move the cursor about looking for it

    Yes, I know what you are describing, it all gets jumbled and the link cant be distinguished from the rest. It depends on your existing css.

    You can edit that html in wp-user-frontend/wpuf-functions.php. You can insert a line brake where you need it, that’s what I did.

    Plugin Author weDevs

    (@wedevs)

    Editing the plugin files is not a wise idea. If you just need to customize the style, override that from your themes style.css file. In that way you will not lose the customizations upon update.

    You can override the plugin files from your theme. But you can only do that if you need to override the functionality or HTML.

    Agree, I don’t like having to do that, but I did need a line brake in the html and I know of no other way. It seems to depend on the theme, I have other wpuf installs where I can adjust the custom fields style with just css.

    A better option would be to do get_post_meta in the template for the posts. That way you can wrap the output in a class and also output other meta for the image as printf or echo.
    Just supply the name of your field. Also don’t forget to un-check the option in wpuf settings to display the meta in the post.

    <?php
    $images = get_post_meta( $post->ID, 'your_field');
    if ( $images ) {
    ?>
    <div class="your-class">
    <?php
    foreach ( $images as $attachment_id ) {
    $thumb = wp_get_attachment_image( $attachment_id, 'additional-image' );
    $full_size = wp_get_attachment_url( $attachment_id );
    
    $post_detail = get_post( $attachment_id );
    $image_html_title =  esc_attr( $post_detail->post_title );
    $image_html_excerpt =  esc_attr($post_detail->post_excerpt);
    $image_html_content =  esc_attr($post_detail->post_content);
    
    printf( '<a title=" ' . $image_html_title . ' "   href="%s">%s</a>', $full_size, $thumb);
    
    echo $image_html_title; ?>
    
    <?php } ?>
    </div>
    <?php } ?>

    ‘additional-image’ is just a custom thumbnail size.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘add a automatically when image is added to posr’ is closed to new replies.