Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • in reply to: Edit in backend an image uploaded in frontend #6943
    eflouret
    Member

    Sorry, it works fine now. I forgot to ad the scope to the front end file field.

    in reply to: Image preview on backend form #6860
    eflouret
    Member

    ok, after some hours of trying to figure the file.php out, I realized that if I save draft or publish eh post, the preview images are shown in their correct size. But that’s not what I meant.

    What I wanted to do is that when I close the add media modal the preview image is in the size I defined in the options without having to save the post to see it. If that’s not possible, then it’s not big deal, I can live without it.

    Regarding the sanitation, I added the code you sent me and I don’t see any difference, I was able to choose and add multiple images.

    Thanks.

    Enrique

    in reply to: Image preview on backend form #6857
    eflouret
    Member

    Thanks Jason for the sanitizing field data, I will check that.

    Yes, the “newsletter” size is registered along with many other sizes that I already use in my posts. Maybe is some kind of scope problem?

    <?php
        add_theme_support( 'post-thumbnails' );
        add_image_size( 'large-square', 400, 400, true );
        add_image_size( 'medium-fb', 600, 314, true );
        add_image_size( 'large-fb', 980, 513, true );
        add_image_size( 'grid-th', 500, 99999 );
        add_image_size( 'medium-longform', 728, 99999 );
    	add_image_size( 'newsletter', 600, 99999 );
    
        add_filter('image_size_names_choose', 'my_image_sizes');
        function my_image_sizes($sizes) {
        $addsizes = array(
            "medium-longform" => __( "Medium Longform"),
            "large-square" => __( "Large Square"),
            "medium-fb" => __( "Medium FB"),
            "large-fb" => __( "Large FB"),
            "grid-th" => __( "Grid Thumbnail"),
            "newsletter" => __( "Newsletter"),
     );
        $newsizes = array_merge($sizes, $addsizes);
        return $newsizes;
        }
    ?>

    I’m using this upload field inside a group with a repeater. That group is inside a Workflow tab and belongs to a custom post type.

    Here’s the code for TAB-1 of the workflow

    <?php
    
    /*
    Title: Add Content
    Order: 10
    Flow: Add Newsletter
    Default: true
    meta_box: false
    Role: administrator
    */
    
    piklist('field', array(
        'type' => 'group'
        ,'columns' => 12
        ,'add_more' => true
        ,'scope' => 'post_meta'
        ,'field' => 'newsletter_articles'
        ,'fields' => array(
             array(
    			'type' => 'text'
    			,'scope' => 'post_meta'
    			,'field' => 'article_title'
    			,'label' => 'Article Title'
    			,'columns' => 12
    			,'attributes' => array(
    				'style="border-radius:3px; padding:10px; font-size:16px"'
    			),
            ),
           array(
    		    'type' => 'editor'
    			,'scope' => 'post_meta'
    			,'field' => 'article_content'
    			,'label' => 'Article Content'
    			,'columns' => 12
    			,'attributes' => array(
    				'rows' => 5,
    				'style="border-radius:3px; padding:10px; font-size:16px"'
    			),
            ),
            array(
    			'type' => 'text'
    			,'scope' => 'post_meta'
    			,'field' => 'article_link'
    			,'label' => 'Article Link'
     			,'columns' => 12
    			,'attributes' => array(
    				'style="border-radius:3px; padding:10px; font-size:16px"'
    			),
           ),
            array(
    			'type' => 'text'
    			,'scope' => 'post_meta'
    			,'field' => 'button_text'
    			,'label' => 'Button Text'
        		,'columns' => 12
    			,'attributes' => array(
    				'style="border-radius:3px; padding:10px; font-size:16px"'
    			),
        ),
             array(
    			'type' => 'file'
    			,'scope' => 'post_meta'
    			,'field' => 'article_image'
    			,'label' => 'Article Image'
    			,'columns' => 12
    			,'attributes' => array(
    				'style="border-radius:3px; padding:10px; font-size:16px"'
    			)
    			,'options' => array(
    			  	'modal_title' => 'Add File(s)'
    				,'preview_size' => 'large-fb'
    			),
            ),
       )
    ));
    
    ?>

    Thanks,

    Enrique

    Attachments:
    You must be logged in to view attached files.
    eflouret
    Member

    Awesome! thanks!

    eflouret
    Member

    Steve, you are awesome. That seems to be what I was looking for.

    I can’t think of better support than the one I get with Piklist!

    I’ve just rated Piklist with 5 stars.

    Where do I paste this code? I assume it goes in the functions.php file, but I’m not sure.

    Thanks!

    Enrique

    eflouret
    Member

    Hi Steve, thanks for your reply.

    Sorry, let’s close this ticket until I have a more specific question to ask.

    Thanks,

    Enrique

    eflouret
    Member

    I forgot to mention that the newsletter is published as a post with my current web site theme.

    And how about this to generate the embed code?:
    In the functions.php file I add a publish_post action where I generate the newsletter embed code looping through all the post meta information for that newsletter post.
    Then I save the embed code in another custom field that is then shown in the TAB2, where I can copy and paste it, and save it for future use.

    Do you think that’s the simplest way to go, or is there something in Piklist that can do this job easier.

    Thanks!

    Enrique

    in reply to: Removing buttons from editor #6787
    eflouret
    Member

    Ok, this works (source: http://rachievee.com/wp-tutorial-remove-tinymce-buttons/)

    function remove_bold_tinymce_button( $buttons ){
          //Remove bold button
          $remove = 'bold';
    
          //Find the array key and then unset
          if ( ( $key = array_search( $remove, $buttons ) ) !== false )
    		unset( $buttons[$key] );
    
          return $buttons;
     }
    
    add_filter( 'teeny_mce_buttons', 'remove_bold_tinymce_button' );

    You can use it with ‘teeny_mce_buttons’ or ‘mce_buttons’. This function will remove the Bold button. Not that I want that, but it is just an example of how to remove a button.

    But it alters all instances of the editor in your site.

    I have to find a way to make this work only in the frontend and in the add_more fields too. I guess that should be fairly easy.

    Any suggestions?

    Enrique

    in reply to: Removing buttons from editor #6786
    eflouret
    Member

    Hi Steve,

    Sorry, but I didn’t test anything yet. I saw several tutorials, but all of them took quite different approaches. Some of them asked for a wp_editor instance ID like this one:

    add_filter( 'teeny_mce_buttons', 'my_editor_buttons', 10, 2 );
    function my_editor_buttons( $buttons, $editor_id ) {
        return array( 'formatselect', 'bold', 'italic' );
    }

    I believe that there is an ID attribute in the WP_EDITOR() that I can pass to piklist, but I didn’t try it. Besides, how will that work with add_more fields?

    Sorry, although I can code a bit of PHP, I’m not a programmer.

    Thanks

    Enrique

Viewing 9 posts - 1 through 9 (of 9 total)