Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter cnever

    (@cnever)

    If you read this bcworkz- is there a way to add you or stay in contact with you via this platform? I am sure I might need your brilliant coding help again!

    Thread Starter cnever

    (@cnever)

    Just to let people know the <br/> code is not necessary (if someone was wondering) and forgot to mark this as resolved!

    Thanks again!

    Thread Starter cnever

    (@cnever)

    WOW bcworkz!

    You simply rock, quick reply and it really worked perfectly final code:

    <br />
    <?php $taxonomy = 'genre';<br />
          $term = 'transfers';<br />
           $link = get_term_link( $term, $taxonomy );<br />
           // getting the specific term assigned to specific taxonomy :)?>
           <li><a href="<?php echo "$link";?>" class="main-links">
                         <h3>Transfers</h3></a></li>

    I think were my problem came in was I used ” for echo and not “”? Or does that not matter?

    Thanks in any case really making a lot of doors open to my design now ??

    Thread Starter cnever

    (@cnever)

    Hi

    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.

    Thread Starter cnever

    (@cnever)

    Hi

    Solution:
    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.
    Cheers

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

    Thanks

    Thread Starter cnever

    (@cnever)

    HI

    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??

    Thread Starter cnever

    (@cnever)

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

    Thread Starter cnever

    (@cnever)

    Here is the file called at the top

    <!--This page is to create post type in admin area-->
    
    <?php
    if (function_exists('add_theme_support')){
    	add_theme_support('post-thumbnails');
    	set_post_thumbnail_size(280,210,true);
    	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);
    }
    
    register_taxonomy("project-type",
    		array("portfolio"),
    		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; ?>" />
    <?php
    }
    
    	add_action('save_post', 'save_project_link');   
    
    function save_project_link(){
        global $post;    
    
        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){
            return $post_id;
        }else{
            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":
                    the_excerpt();
                    break;
                case "link":
                    $custom = get_post_custom();
                    echo $custom["projLink"][0];
                    break;
                case "type":
                    echo get_the_term_list($post->ID, 'project-type', '', ', ','');
                    break;
            }
    }    
    
    ?>
    Thread Starter cnever

    (@cnever)

    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')) {
        add_theme_support('menus');
    	add_theme_support('post-thumbnails');
    } 
    
    //asigning class to thumbnail
    the_post_thumbnail('thumbnail', array('class' => 'gallery_image_expanded'));
    
    //remove admin rights
     function remove_menus()
    {
        global $menu;
        global $current_user;
        get_currentuserinfo();
    
        if($current_user->user_login == 'second admin')
        {
            $restricted = array(__('Posts'),
                                __('Media'),
                                __('Links'),
                                __('Pages'),
                                __('Comments'),
                                __('Appearance'),
                                __('Plugins'),
                                __('Users'),
                                __('Tools'),
                                __('Settings')
            );
    		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;
    $start=$imgEnd+1;
    }
    if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
    $more = 0;
    }
    ?>
    <?php
    //debugging log
    if(!function_exists('_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 );
          }
        }
      }
    }
    ?>
    Thread Starter cnever

    (@cnever)

    Hi Emil

    I am not using any theme. And yes have done some mad reading about the custom posts. I have them in my dashboard and they are also working (mostly).

    That is why my main concern is the styling of navigation, actually I don’t want to use wordpress for the navigation to be honest. But for some reason I can’t force linking the pages to each other (like explained above).

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)