znagle 0 Report post Posted October 28, 2010 Is there a simple way to make box images clickable links? Thanks, Zach Share this post Link to post Share on other sites
cmunns 16 Report post Posted October 28, 2010 If you use this code for your section.boxes.php file then yes. I've created a new option in the code below. ` <?php /* Section: PageLines Boxes Author: Andrew Powers Description: Creates boxes and box layouts Version: 1.0.0 */ class PageLinesBoxes extends PageLinesSection { function __construct( $registered_settings = array() ) { $name = __('PageLines Boxes', 'pagelines'); $id = 'boxes'; $default_settings = array( 'description' => 'Inline boxes on your page that support images and media. Great for feature lists, and media.', 'icon' => CORE_IMAGES.'/admin/boxes.png', 'version' => 'pro', ); $settings = wp_parse_args( $registered_settings, $default_settings ); parent:GDN__construct($name, $id, $settings); } /* Loads php that will run on every page load (admin and site) Used for creating administrative information, like post types */ function section_persistent(){ /* Create Custom Post Type */ $args = array( 'label' => __('Boxes', 'pagelines'), 'singular_label' => __('Box', 'pagelines'), 'description' => 'For creating boxes in box type layouts.' ); $taxonomies = array( "box-sets" => array( "label" => __('Box Sets', 'pagelines'), "singular_label" => __('Box Set', 'pagelines'), ) ); $columns = array( "cb" => "", "title" => "Title", "bdescription" => "Text", "bmedia" => "Media", "box-sets" => "Box Sets" ); $column_value_function = 'box_column_display'; $this->post_type = new PageLinesPostType($this->id, $args, $taxonomies, $columns, $column_value_function); /* Set default posts if none are present */ $this->post_type->set_default_posts('pagelines_default_boxes'); /* Meta Options */ /* Create meta fields for the post type */ $this->meta_array = array( 'the_box_icon' => array( 'version' => 'pro', 'type' => 'image_upload', 'inputlabel' => 'Box Image', 'exp' => 'Upload an image for the box. Depending on your settings this image will be used as an icon, or splash image; so desired size may vary.' ), 'icon_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ) ); $post_types = array($this->id); $this->meta_settings = array( 'id' => 'box-meta', 'name' => THEMENAME." Box Options", 'posttype' => $post_types ); $this->meta_options = new PageLinesMetaOptions($this->meta_array, $this->meta_settings); /* Create meta fields for the page template when using the Feature Template */ $meta_array = array( 'box_set' => array( 'version' => 'pro', 'type' => 'select_taxonomy', 'taxonomy_id' => "box-sets", 'inputlabel' => 'Select Box Set To Show', 'exp' => 'If you are using the box section, select the box set you would like to show on this page.' ), 'box_col_number' => array( 'type' => 'count_select', 'count_number' => '5', 'count_start' => '2', 'inputlabel' => 'Number of Feature Box Columns', 'title' => 'Box Columns', 'shortexp' => "Select the number of columns to show boxes in.", 'exp' => "The number you select here will be the number of boxes listed in a row on a page. Note: This won't work on the blog page (use the global option)." ), 'box_thumb_type' => array( 'version' => 'pro', 'type' => 'select', 'selectvalues' => array( 'inline_thumbs' => array("name" => "Thumbs On Left"), 'top_thumbs' => array("name" => "Thumbs On Top") ), 'inputlabel' => 'Box Thumb Position', 'exp' => 'Choose between thumbs on left and thumbs on top of boxes.', ), 'box_thumb_size' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Box Icon Size (in Pixels)', 'shortexp' => "Add the icon size in pixels", 'exp' => "Select the default icon size in pixels, set the images when creating new boxes.", ), ); $meta_settings = array( 'id' => 'box-template-meta', 'name' => THEMENAME." Box Section Options", 'posttype' => 'page' ); $this->meta_options = new PageLinesMetaOptions($meta_array, $meta_settings); } function section_template() { global $post; $current_post = $post; // inserts a clearing element at the end of each line of boxes $perline = (isset($post) && pagelines('box_col_number', $post->ID)) ? pagelines('box_col_number', $post->ID) : 3; $count = $perline; $box_thumb_size = (isset($post) && pagelines('box_thumb_size', $post->ID)) ? pagelines('box_thumb_size', $post->ID) : 64; $box_thumb_type = (isset($post) && pagelines('box_thumb_type', $post->ID)) ? pagelines('box_thumb_type', $post->ID) : 'inline_thumbs'; ?> <?php // Let's Do This... $theposts = $this->get_box_posts(); $boxes = (is_array($theposts)) ? $theposts : array(); foreach($boxes as $post) : setup_postdata($post); $custom = get_post_custom($post->ID); ?> <?php if(get_post_meta($post->ID, 'the_box_icon', true)):?> <?php endif;?> <?php the_title(); ?> <?php the_content(); ?><?php edit_post_link(__('[Edit Box]', 'pagelines'), '', '');?> <?php pagelines_register_hook( 'pagelines_box_inside_bottom', $this->id ); // Hook ?> <?php $end = ($count+1) / $perline; if(is_int($end)):?><?php endif;?> <?php $count++;?> <?php endforeach;?> <?php } function get_box_posts(){ global $post; if(!isset($this->the_feature_boxes) && isset($post)){ $query_args = array('post_type' => $this->id, 'orderby' =>'ID'); if( get_pagelines_meta('box_set', $post->ID) ){ $query_args = array_merge($query_args, array( 'box-sets' => get_post_meta($post->ID, 'box_set', true) ) ); }elseif (pagelines_non_meta_data_page() && pagelines_option('box_default_tax')){ $query_args = array_merge($query_args, array( 'box-sets' => pagelines_option('box_default_tax') ) ); } if(pagelines('box_items', $post->ID)){ $query_args = array_merge($query_args, array( 'showposts' => pagelines_option('box_items', $post->ID) ) ); } $boxes_query = new WP_Query($query_args); $this->the_feature_boxes = $boxes_query->posts; if(is_array($this->the_feature_boxes)) return $this->the_feature_boxes; else return array(); } elseif(isset($post)) { return $this->the_feature_boxes; } } function section_head() { } function section_scripts() { } function section_options($optionset = null, $location = null) { if($optionset == 'new' && $location == 'bottom'){ return array( 'box_settings' => array( 'box_col_number' => array( 'default' => 3, 'version' => 'pro', 'type' => 'count_select', 'count_number' => '5', 'count_start' => '2', 'inputlabel' => 'Default Number of Feature Box Columns', 'title' => 'Box Columns', 'shortexp' => "Select the number of columns to show boxes in.", 'exp' => "The number you select here will be the number of boxes listed in a row on a page." ), 'box_items' => array( 'default' => 5, 'version' => 'pro', 'type' => 'text_small', 'inputlabel' => 'Maximum Boxes To Show', 'title' => 'Default Number of Boxes', 'shortexp' => "Select the max number of boxes to show.", 'exp' => "This will be the maximum number of boxes shown on an individual page.", ), 'box_thumb_size' => array( 'default' => 64, 'version' => 'pro', 'type' => 'text_small', 'inputlabel' => 'Box Icon Size (in Pixels)', 'title' => 'Default Box Icon Size', 'shortexp' => "Add the icon size in pixels", 'exp' => "Select the default icon size in pixels, set the images when creating new boxes.", ), 'box_default_tax' => array( 'default' => 'default-boxes', 'version' => 'pro', 'taxonomy_id' => 'box-sets', 'type' => 'select_taxonomy', 'inputlabel' => 'Select Posts/404 Box Set', 'title' => 'Posts Page and 404 Box Set', 'shortexp' => "Posts pages and similar pages (404) will use this box-set ID", 'exp' => "Posts pages and 404 pages in WordPress don't support meta data so you need to assign a set here. (If you want to use 'boxes' on these pages.)", ) ) ); } } // End of Section Class // } function box_column_display($column){ global $post; switch ($column){ case "bdescription": the_excerpt(); break; case "bmedia": if(get_post_meta($post->ID, 'the_box_icon', true )){ echo ''; } break; case "box-sets": echo get_the_term_list($post->ID, 'box-sets', '', ', ',''); break; } } function pagelines_default_boxes($post_type){ $default_posts = array_reverse(get_default_fboxes()); foreach($default_posts as $dpost){ // Create post object $default_post = array(); $default_post['post_title'] = $dpost['title']; $default_post['post_content'] = $dpost['text']; $default_post['post_type'] = $post_type; $default_post['post_status'] = 'publish'; $newPostID = wp_insert_post( $default_post ); update_post_meta($newPostID, 'the_box_icon', $dpost['media']); wp_set_object_terms($newPostID, 'default-boxes', 'box-sets'); } } ` Share this post Link to post Share on other sites
znagle 0 Report post Posted October 28, 2010 Thanks for taking the time to add that. Unfortunately I'm getting this error: Parse error: syntax error, unexpected T_STRING, expecting ')' in /home2/futurera/public_html/wp-content/themes/platformpro/sections/boxes/section.boxes.php on line 52 Any ideas? Share this post Link to post Share on other sites
znagle 0 Report post Posted October 28, 2010 Nevermind, I found the error. Line 52 should be: "cb" => "<input type="checkbox" />", Now it works. Thanks! Share this post Link to post Share on other sites
znagle 0 Report post Posted October 28, 2010 After examining the code you modified, I've tried to add image links to banners too by editing section.banners.php. I have the meta option added and the links functioning, but I'm having trouble styling the link correctly. Here is the code I added: 'banner_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ), I believe the problem is in here: <div class="banner-content"> ID, 'icon_link', true);?>">ID, 'the_banner_image', true);?>" style="width:<?php echo $banner_align;?>%"> <?php the_content(); ?> <?php edit_post_link(__('<small>[Edit Banner]</small>', 'pagelines'), '', '');?> </div> [/code] Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted October 29, 2010 Bumping for developer support, please bump again yourself. Thanks, Bryan Share this post Link to post Share on other sites
znagle 0 Report post Posted October 29, 2010 Bump. Is this possible? Share this post Link to post Share on other sites
cmunns 16 Report post Posted October 29, 2010 It would be the same as the boxes. Remember that if the option array is banner_link you have to replace what used to be "icon_link" to "banner_link when creating the PHP. In the above code you still are using icon_link Share this post Link to post Share on other sites
seanbaugh 0 Report post Posted November 3, 2010 Ive tried this as well - and Im also getting the same parse error as above. Ive replaced it with ... "cb" => "<input type="checkbox" />", but does not work. Any ideas? Share this post Link to post Share on other sites
ralphgriffiths 0 Report post Posted November 12, 2010 Hi, sorry to back track, but is it possible for the code illiterate amongst your clientele to have this function? I tried to follow the steps above but have absolutely no way of making it work. Can someone provide a walk through of how I can apply the function? Thanks a lot. Share this post Link to post Share on other sites
cmunns 16 Report post Posted November 15, 2010 Basically we added this ` 'icon_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ) ); ` to this portion of code in the section.boxes.php You can use the same option, however for banners as well. Here is where it is placed in the context of the file ` /* Meta Options */ /* Create meta fields for the post type */ $this->meta_array = array( 'the_box_icon' => array( 'version' => 'pro', 'type' => 'image_upload', 'inputlabel' => 'Box Image', 'exp' => 'Upload an image for the box. Depending on your settings this image will be used as an icon, or splash image; so desired size may vary.' ), 'icon_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ) ); ` Now we have to add the link and option we created in the section template function of the file. ` <?php if(get_post_meta($post->ID, 'the_box_icon', true)):?> <?php endif;?> ` Above is how it looks without the added link option. You'll see the get_post_meta function with "the_box_icon" as a parameter. That parameter has to match with the option created. So adding the link in there would be like so ` <?php if(get_post_meta($post->ID, 'the_box_icon', true)):?> <?php endif;?> ` Which you can see links up "icon_link" from the meta option and passes as a parameter into the get_post_meta function. Hopefully this is more clear. Share this post Link to post Share on other sites
ralphgriffiths 0 Report post Posted November 15, 2010 It is. Thanks a lot for your well thought out response. I'll give it another shot. Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted November 16, 2010 Has anyone had their problem resolved by the replies above yet? Thanks, Bryan Share this post Link to post Share on other sites
surfcity 0 Report post Posted November 16, 2010 Where is the section.boxs.php Do I have to create one? Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted November 17, 2010 Appearance > Editor > section.boxes.php Thanks, Bryan Share this post Link to post Share on other sites
surfcity 0 Report post Posted November 17, 2010 I still don't see it Share this post Link to post Share on other sites
Kate 3 Report post Posted November 17, 2010 Jason - If you're not seeing it in the WordPress visual editor, you can access it directly through your "themes" folder. Inside of your "platformpro" theme folder, you'll find it under the sections->boxes directory. Share this post Link to post Share on other sites
surfcity 0 Report post Posted November 18, 2010 I'm new to this and I get this error. Parse error: syntax error, unexpected T_DOUBLE_ARROW in /wp-content/themes/platformpro/sections/boxes/section.boxes.php on line 329 Share this post Link to post Share on other sites
Kate 3 Report post Posted November 18, 2010 Jason - Could you paste that portion of the code here, please? Thanks Share this post Link to post Share on other sites
surfcity 0 Report post Posted November 19, 2010 Hope this is what you want <?php /* Section: PageLines Boxes Author: Andrew Powers Description: Creates boxes and box layouts Version: 1.0.0 */ class PageLinesBoxes extends PageLinesSection { function __construct( $registered_settings = array() ) { $name = __('PageLines Boxes', 'pagelines'); $id = 'boxes'; $default_settings = array( 'description' => 'Inline boxes on your page that support images and media. Great for feature lists, and media.', 'icon' => CORE_IMAGES.'/admin/boxes.png', 'version' => 'pro', ); $settings = wp_parse_args( $registered_settings, $default_settings ); parent:GDN__construct($name, $id, $settings); } /* Loads php that will run on every page load (admin and site) Used for creating administrative information, like post types */ function section_persistent(){ /* Create Custom Post Type */ $args = array( 'label' => __('Boxes', 'pagelines'), 'singular_label' => __('Box', 'pagelines'), 'description' => 'For creating boxes in box type layouts.' ); $taxonomies = array( "box-sets" => array( "label" => __('Box Sets', 'pagelines'), "singular_label" => __('Box Set', 'pagelines'), ) ); $columns = array( "cb" => "<input type="checkbox" />", "title" => "Title", "bdescription" => "Text", "bmedia" => "Media", "box-sets" => "Box Sets" ); $column_value_function = 'box_column_display'; $this->post_type = new PageLinesPostType($this->id, $args, $taxonomies, $columns, $column_value_function); /* Set default posts if none are present */ $this->post_type->set_default_posts('pagelines_default_boxes'); /* Meta Options */ /* Create meta fields for the post type */ $this->meta_array = array( 'the_box_icon' => array( 'version' => 'pro', 'type' => 'image_upload', 'inputlabel' => 'Box Image', 'exp' => 'Upload an image for the box. Depending on your settings this image will be used as an icon, or splash image; so desired size may vary.' ), 'icon_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ) );<?php if(get_post_meta($post->ID, 'the_box_icon', true)):?> <div class="fboxgraphic"> ID, 'icon_link', true);?>"> ID, 'the_box_icon', true);?>" style="width:<?php echo $box_thumb_size;?>px"> </div> <?php endif;?> $post_types = array($this->id); $this->meta_settings = array( 'id' => 'box-meta', 'name' => THEMENAME." Box Options", 'posttype' => $post_types ); $this->meta_options = new PageLinesMetaOptions($this->meta_array, $this->meta_settings); /* Create meta fields for the page template when using the Feature Template */ $meta_array = array( 'box_set' => array( 'version' => 'pro', 'type' => 'select_taxonomy', 'taxonomy_id' => "box-sets", 'inputlabel' => 'Select Box Set To Show', 'exp' => 'If you are using the box section, select the box set you would like to show on this page.' ), 'box_col_number' => array( 'type' => 'count_select', 'count_number' => '5', 'count_start' => '2', 'inputlabel' => 'Number of Feature Box Columns', 'title' => 'Box Columns', 'shortexp' => "Select the number of columns to show boxes in.", 'exp' => "The number you select here will be the number of boxes listed in a row on a page. Note: This won't work on the blog page (use the global option)." ), 'box_thumb_type' => array( 'version' => 'pro', 'type' => 'select', 'selectvalues' => array( 'inline_thumbs' => array("name" => "Thumbs On Left"), 'top_thumbs' => array("name" => "Thumbs On Top") ), 'inputlabel' => 'Box Thumb Position', 'exp' => 'Choose between thumbs on left and thumbs on top of boxes.', ), 'box_thumb_size' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Box Icon Size (in Pixels)', 'shortexp' => "Add the icon size in pixels", 'exp' => "Select the default icon size in pixels, set the images when creating new boxes.", ), ); $meta_settings = array( 'id' => 'box-template-meta', 'name' => THEMENAME." Box Section Options", 'posttype' => 'page' ); $this->meta_options = new PageLinesMetaOptions($meta_array, $meta_settings); } function section_template() { global $post; $current_post = $post; // inserts a clearing element at the end of each line of boxes $perline = (isset($post) && pagelines('box_col_number', $post->ID)) ? pagelines('box_col_number', $post->ID) : 3; $count = $perline; $box_thumb_size = (isset($post) && pagelines('box_thumb_size', $post->ID)) ? pagelines('box_thumb_size', $post->ID) : 64; $box_thumb_type = (isset($post) && pagelines('box_thumb_type', $post->ID)) ? pagelines('box_thumb_type', $post->ID) : 'inline_thumbs'; ?> <div class="dcol_container_<?php echo $perline;?> fix"> <?php // Let's Do This... $theposts = $this->get_box_posts(); $boxes = (is_array($theposts)) ? $theposts : array(); foreach($boxes as $post) : setup_postdata($post); $custom = get_post_custom($post->ID); ?> <div class="dcol_<?php echo $perline;?> dcol"> <div class="dcol-pad <?php echo $box_thumb_type;?>"> <?php if(get_post_meta($post->ID, 'the_box_icon', true)):?> <div class="fboxgraphic"> ID, 'icon_link', true);?>"> ID, 'the_box_icon', true);?>" style="width:<?php echo $box_thumb_size;?>px"> </div> <?php endif;?> <div class="fboxinfo fix"> <div class="fboxtitle"><h3><?php the_title(); ?></h3></div> <div class="fboxtext"><?php the_content(); ?><?php edit_post_link(__('[Edit Box]', 'pagelines'), '', '');?></div> </div> <?php pagelines_register_hook( 'pagelines_box_inside_bottom', $this->id ); // Hook ?> </div> </div> <?php $end = ($count+1) / $perline; if(is_int($end)):?><div class="clear"></div><?php endif;?> <?php $count++;?> <?php endforeach;?> </div> <div class="clear"></div> <?php } function get_box_posts(){ global $post; if(!isset($this->the_feature_boxes) && isset($post)){ $query_args = array('post_type' => $this->id, 'orderby' =>'ID'); if( get_pagelines_meta('box_set', $post->ID) ){ $query_args = array_merge($query_args, array( 'box-sets' => get_post_meta($post->ID, 'box_set', true) ) ); }elseif (pagelines_non_meta_data_page() && pagelines_option('box_default_tax')){ $query_args = array_merge($query_args, array( 'box-sets' => pagelines_option('box_default_tax') ) ); } if(pagelines('box_items', $post->ID)){ $query_args = array_merge($query_args, array( 'showposts' => pagelines_option('box_items', $post->ID) ) ); } $boxes_query = new WP_Query($query_args); $this->the_feature_boxes = $boxes_query->posts; if(is_array($this->the_feature_boxes)) return $this->the_feature_boxes; else return array(); } elseif(isset($post)) { return $this->the_feature_boxes; } } function section_head() { } function section_scripts() { } function section_options($optionset = null, $location = null) { if($optionset == 'new' && $location == 'bottom'){ return array( 'box_settings' => array( 'box_col_number' => array( 'default' => 3, 'version' => 'pro', 'type' => 'count_select', 'count_number' => '5', 'count_start' => '2', 'inputlabel' => 'Default Number of Feature Box Columns', 'title' => 'Box Columns', 'shortexp' => "Select the number of columns to show boxes in.", 'exp' => "The number you select here will be the number of boxes listed in a row on a page." ), 'box_items' => array( 'default' => 5, 'version' => 'pro', 'type' => 'text_small', 'inputlabel' => 'Maximum Boxes To Show', 'title' => 'Default Number of Boxes', 'shortexp' => "Select the max number of boxes to show.", 'exp' => "This will be the maximum number of boxes shown on an individual page.", ), 'box_thumb_size' => array( 'default' => 64, 'version' => 'pro', 'type' => 'text_small', 'inputlabel' => 'Box Icon Size (in Pixels)', 'title' => 'Default Box Icon Size', 'shortexp' => "Add the icon size in pixels", 'exp' => "Select the default icon size in pixels, set the images when creating new boxes.", ), 'box_default_tax' => array( 'default' => 'default-boxes', 'version' => 'pro', 'taxonomy_id' => 'box-sets', 'type' => 'select_taxonomy', 'inputlabel' => 'Select Posts/404 Box Set', 'title' => 'Posts Page and 404 Box Set', 'shortexp' => "Posts pages and similar pages (404) will use this box-set ID", 'exp' => "Posts pages and 404 pages in WordPress don't support meta data so you need to assign a set here. (If you want to use 'boxes' on these pages.)", ) ) ); } } // End of Section Class // } function box_column_display($column){ global $post; switch ($column){ case "bdescription": the_excerpt(); break; case "bmedia": if(get_post_meta($post->ID, 'the_box_icon', true )){ echo 'ID, 'the_box_icon', true ).'" style="width: 80px; margin: 10px; border: 1px solid #ccc; padding: 5px; background: #fff" />'; } break; case "box-sets": echo get_the_term_list($post->ID, 'box-sets', '', ', ',''); break; } } function pagelines_default_boxes($post_type){ $default_posts = array_reverse(get_default_fboxes()); foreach($default_posts as $dpost){ // Create post object $default_post = array(); $default_post['post_title'] = $dpost['title']; $default_post['post_content'] = $dpost['text']; $default_post['post_type'] = $post_type; $default_post['post_status'] = 'publish'; $newPostID = wp_insert_post( $default_post ); update_post_meta($newPostID, 'the_box_icon', $dpost['media']); wp_set_object_terms($newPostID, 'default-boxes', 'box-sets'); } } 'icon_link' => array( 'version' => 'pro', 'type' => 'text', 'inputlabel' => 'Image Link', 'exp' => 'Enter a URL link for your icon' ) ); Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted November 19, 2010 Continued developer support soon... Thanks, Bryan Share this post Link to post Share on other sites