Support » Fixing WordPress » Crop tool not working

  • Resolved cnever



    I see this thread is closed.

    I have the exact same problem, and dit fix the gaps in my code but still the same thing is happening.

    Any other suggestions would be great.


Viewing 9 replies - 1 through 9 (of 9 total)
  • Heya cnever,

    When you say you had the “…exact same problem…” does that mean you are using a custom made theme for your site? If so, did you check the spacing (gaps as they are called in that thread) in the functions.php AND any .php files (the code in those files) which might be called in the functions.php file?

    Let us know.


    Hi James

    custom made theme – yes
    Please see following code but according to me all gaps are gone? (both files)

    Sorry for the long code (cant remember if there was another place where I was suppose to paste this?

    <?php require_once('portfolio-type.php')?>
    <?php add_filter('excerpt_length', 'my_excerpt_length');
    function my_excerpt_length($length) {
    	return 25;
    add_filter('excerpt_more', 'new_excerpt_more');
    function new_excerpt_more($text){
    	return ' ';
    function portfolio_thumbnail_url($pid){
    	$image_id = get_post_thumbnail_id($pid);
    	$image_url = wp_get_attachment_image_src($image_id, 'screen-shot');
    	return $image_url[0];
     if (function_exists('add_theme_support')) {
    //asigning class to thumbnail
    the_post_thumbnail('thumbnail', array('class' => 'gallery_image_expanded'));
    //remove admin rights
     function remove_menus()
        global $menu;
        global $current_user;
        if($current_user->user_login == 'second admin')
            $restricted = array(__('Posts'),
    		add_filter( 'show_admin_bar', '__return_false' );
            end ($menu);
            while (prev($menu)){
                $value = explode(' ',$menu[key($menu)][0]);
                if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
            }// end while
        }// end if
    add_action('admin_menu', 'remove_menus');
    //gets image path to display where ever
    function getImage($num) {
    global $more;
    $more = 1;
    $link = get_permalink();
    $content = get_the_content();
    $count = substr_count($content, '<img');
    $start = 0;
    for($i=1;$i<=$count;$i++) {
    $imgBeg = strpos($content, '<img', $start);
    $post = substr($content, $imgBeg);
    $imgEnd = strpos($post, '>');
    $postOutput = substr($post, 0, $imgEnd+1);
    $postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
    $image[$i] = $postOutput;
    if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
    $more = 0;
    //debugging log
      function _log( $message ) {
        if( WP_DEBUG === true ){
          if( is_array( $message ) || is_object( $message ) ){
            error_log( print_r( $message, true ) );
          } else {
            error_log( $message );

    Here is the file called at the top

    <!--This page is to create post type in admin area-->
    if (function_exists('add_theme_support')){
    	add_image_size('screen-shot', 720,540);
    add_action('init', 'portfolio_register');
    function portfolio_register() {
    	$args = array(
    	'label' => __('Portfolio'),
            'singular_label' => __('Project'),
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'rewrite' => true,
    		'query_var'=> true,
    		'menu position' => null,
            'supports' => array('title', 'editor', 'thumbnail')
    	register_post_type('portfolio', $args);
    		array("hierarchical" => true,
    		"label" => "Project Types",
    		"singular_label" =>
    		"Project Type",
    		"rewrite" => true));  
    // custom meta box//
    add_action("admin_init", "portfolio_meta_box");// hook for admin/dashboard creation
    function portfolio_meta_box(){ //create the meta box
    	add_meta_box("projInfo-meta", "Project Options", "portfolio_meta_options", "Portfolio", "side", "low");
    function portfolio_meta_options(){    //calling the metabox and link to display
            global $post;
            if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
            $custom = get_post_custom($post->ID);
            $link = $custom["projLink"][0];
        <label>Link:</label><input name="projLink" value="<?php echo $link; ?>" />
    	add_action('save_post', 'save_project_link');   
    function save_project_link(){
        global $post;    
        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){
            return $post_id;
            update_post_meta($post->ID, "projLink", $_POST["projLink"]);
    //creating colums in the dashboard
    add_filter("manage_edit-portfolio_columns", "project_edit_columns");     
    function project_edit_columns($columns){
            $columns = array(
                "cb" => "<input type=\"checkbox\" />",
                "title" => "Project",
                "description" => "Description",
                "link" => "Link",
                "type" => "Type of Project",
            return $columns;
    add_action("manage_posts_custom_column",  "project_custom_columns");   
    function project_custom_columns($column){
            global $post;
            switch ($column)
                case "description":
                case "link":
                    $custom = get_post_custom();
                    echo $custom["projLink"][0];
                case "type":
                    echo get_the_term_list($post->ID, 'project-type', '', ', ','');

    You will see there are gaps between the php tags but not when they close, or am I missing something?

    Heya cnever,

    Nothing “jumps” out at me with that code, however, admittedly, I am still learning about hooks and actions and things. My trouble shooting tip, though, would be to ask if you have gone back to the default WordPress theme (making sure no adjustments or additions have been made to the functions.php file) and see if you are able to see the images in the cropping tool at that point. If so, clearly the challenge is in the custom theme.

    Let us know.

    Cheers! :)


    Yip, because the 2011 standard theme works perfectly? But the thing is I did not change anything besides the theme files. I have a index,functions,header,2custom pages,product loop. But according to me those don’t matter right? Only the functions is the one I would think that is important? But according to me the functions file does not control the admin area? I could be wrong just trying to narrow down the search because it is going to take forever to delete junks of code and see what happens.

    Because I am definitely not skilled enough to really know what I am deleting or looking for.

    Thanks for feedback in any case.
    ps: just deleted the whole funtions file form 2011 – still works the editor so it’s not that file at all??


    Open my eyes and redo as said in this post
    **NO, NO, NO spaces at the top of the function file, and files called in at the top, even before the php tags, so no comments/hmtl comments etc.

    You would not believe me but I think I figured it out.
    Now please if any body knows this, it is a very simple question.
    Do you always have to put a the ; (semi-colon) after each line even if the line gets closed with php tag. Reason why I am asking I have seen code where this is not done at all and worked?
    But this could also just be my very “trained” eye not picking up the syntax in context if you know what I mean.

    Thanks for James giving me the idea to inspect/trouble shoot.

    If you look at the top where it is asking acquire there is no semi colon, that was issue number 1 (although testing it now again this does not make a difference wow?)
    Issue number 2 was the comment before my php tag starts must be deleted completely and comment inside php tag.

    So conclusion is I am stupid, anyway thanks for the direction James.

    PS: do have a question regarding how to better manage the thumbnail look/cropping – code or in backend?


    Heya cnever,

    No reason whatsoever to consider yourself anything other than one with slightly less experience with all this. We all learn new stuff every day (hopefully! I know I do!!)

    Yeah, it was hard to determine the spacing issues at the beginning of the code that was inserted here. As to the commented section at the top of the portfolio-type.php page, I (ahem) assumed you had put that in when you inserted the code to this page.

    Good for you, good for you. As to your question:

    PS: do have a question regarding how to better manage the thumbnail look/cropping – code or in backend?

    may I suggest you create a new post in the appropriate forum?

    Cheers! :)


    Yip I figured that it would be a new post. But think I know the solution to it – just a plugin. But I like customized stuff so much.

    Any case thanks again.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Crop tool not working’ is closed to new replies.