Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help customizing a wordpress theme.

Posted on 2012-09-18
18
Medium Priority
?
1,378 Views
Last Modified: 2012-09-25
Hi,
We purchased a wordpress theme for our site. I have been learning wordpress but do not know how to customize it to make it do what I want. I contacted the place where we purchased the theme but apparently what I want is too advanced to get regular help. This is the url to link to the website I am talking about http://www.g3creative.com/g3wp55 . So on the home page there are 8 squares. Each Square links to a blog post. I want each square to link a different portfolio page. Each square will be a different page of the portfolio, so one would be logos, another would be print etc. So when someone clicks on the square for logos I want it to go to the logos portfolio page. How can I do this? I am a beginner in wordpress so I have no idea where to look. Thanks in advance.
0
Comment
Question by:designrox
  • 9
  • 6
16 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38412000
How do you set the content that's in the boxes currently?
0
 

Author Comment

by:designrox
ID: 38412014
It's preset from template monster. What it looks like is it takes the latest posts that are added in the portfolio and places them in those 8 slots. So my 2 problems are that 1) I want those to be links to pages and 2) If I upload another post in the portfolio I don't want it to override my page links. Hope that makes sense. This is the original theme on the template monster site:
http://www.templatemonster.com/demo/39178.html
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38412022
It's preset from template monster

Bleah. Okay, I think you are dealing with widgets here.  If you go to the backend and select Appearance | Widgets you should see a bunch of defined areas on the right side of the screen.

Look for something that says either Main Home or 1st Home Area and expand it.  Take a screenshot of the result and post it back here.

1) I want those to be links to pages and 2) If I upload another post in the portfolio I don't want it to override my page links.

Assuming we are dealing with widgets you may be okay.  My fear is that this may be heavily customized and not simple to modify.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:designrox
ID: 38412036
You were right. It looks like it is a widget. I have attached the screenshot.
dashboard.jpg
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38412062
And my fears are also right.  It's a custom widget created by the theme author and not something easy to change to do what you want.  You would basically have to re-code the thing from the ground up to use Pages and not Posts.
0
 

Author Comment

by:designrox
ID: 38412360
So would that be something where I would have to re-code the php files as well as CSS? I'm willing to do it if I just know where to look. Problem is I have no idea where to start.
0
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 1500 total points
ID: 38412379
You need to customize your post and homepage also. You have to know about custom post type. You can see it on wordpress codex. It will help you to manage custom post and each of the block will link you on a different portfolio page as you describe.

See link for reference:
https://codex.wordpress.org/Post_Types
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38412417
That's a good point and I'm embarrassed I didn't think of it.  

You could make your portfolio posts a custom post type and then copy the content over and possibly use the existing widget as is.  It may require a slight tweak to the Loop portion of the widget so that it pulls custom posts but otherwise it would be unaltered.  Nice work  jagadishdulal!
0
 

Author Comment

by:designrox
ID: 38415870
So I think I kind of get what you are saying. I have read up on custom post types but am not sure if I understand it all. What I gather is that I have to create a custom post type. First question is where do I do that? Do I create a new php file or do I add it in to an existing php file and if so, which one? Also, the example given in the link to the codex that was included in jagadishsulal's comment says to create a post type like this:

add_action( 'init', 'create_post_type' );
function create_post_type() {
      register_post_type( 'acme_product',
            array(
                  'labels' => array(
                        'name' => __( 'Products' ),
                        'singular_name' => __( 'Product' )
                  ),
            'public' => true,
            'has_archive' => true,
            )
      );
}

Do I need to add anything else to that code (besides change the names of course) or is that all I have to do. Also, after I create this post type. How would I go about linking it to the pages? I am super new at the editing side of things so I'm sorry if this is a lot of questions. Thanks in advance for your help.
0
 

Author Comment

by:designrox
ID: 38415925
Also, I found a file titled "single-portfolio.php." Could I code this section and make it work or does that do nothing? There are only 31 lines of code so I was wondering if it would be easier to go that way. Just a question.
0
 

Author Comment

by:designrox
ID: 38420283
I figured out how to add a custom post and it now appears in my dashboard. But in my post cycle options it does not show the new "home posts" custom post I created. Below is the php code in the my-post-cycle-widget where I think I need to add something to make it appear right? I figured I could copy and paste another one of the custom posts code and change out the name. However, I don't know where to start copying and where to end it. Code is below.

<?php
/*
// =============================== My advanced cycle widget ======================================*/
class MY_PostsTypeWidget extends WP_Widget {

function MY_PostsTypeWidget() {
		$widget_ops = array('classname' => 'my_posts_type_widget', 'description' => __('Show custom posts'));
		$control_ops = array('width' => 500, 'height' => 350);
	    parent::WP_Widget(false, __('My - Advanced Cycle'), $widget_ops, $control_ops);
}

/**
 * Displays custom posts widget on blog.
 */
function widget($args, $instance) {
	global $post;
	$post_old = $post; // Save the post object.
	
	extract( $args );
	$limit = apply_filters('widget_title', $instance['excerpt_length']);
	
  $valid_sort_orders = array('date', 'title', 'comment_count', 'rand');
  if ( in_array($instance['sort_by'], $valid_sort_orders) ) {
    $sort_by = $instance['sort_by'];
    $sort_order = (bool) $instance['asc_sort_order'] ? 'ASC' : 'DESC';
  } else {
    // by default, display latest first
    $sort_by = 'date';
    $sort_order = 'DESC';
  }
	
	// Get array of post info.
  $cat_posts = new WP_Query(
    "showposts=" . $instance["num"] . 
    "&post_type=" . $instance['posttype'] .
    "&orderby=" . $sort_by .
    "&order=" . $sort_order
  );
	
	echo $before_widget;
	
	// Widget title
	// If title exist.
	if( $instance["title"] ) {
	echo $before_title;
		echo $instance["title"];
	echo $after_title;
    }

	// Posts list
    if($instance['container_class']==""){
	echo "<ul class='post_list'>\n";
	}else{
    echo "<ul class='post_list " .$instance['container_class'] ."'>\n";
    }
	
	$limittext = $limit;
	$posts_counter = 0;
	while ( $cat_posts->have_posts() )
	{
		$cat_posts->the_post(); $posts_counter++;
	?>
    <?php if ($instance['posttype'] == "testi") {
      $custom = get_post_custom($post->ID);
      $testiname = $custom["testimonial-name"][0];
    }?>
		<li class="cat_post_item-<?php echo $posts_counter; ?> clearfix">
			<?php if ($instance["thumb"]) : ?>
			  <?php if ( $instance['thumb_as_link'] ) : ?>
                <a href="<?php the_permalink() ?>">
              <?php endif; ?>
              <?php if($instance['thumb_w']!=="" || $instance['thumb_h']!==""){ ?>
                <?php the_post_thumbnail(array($instance['thumb_w'],$instance['thumb_h'])); ?>
              <?php }else{?>
                <?php the_post_thumbnail(); ?>
              <?php }?>
			  <?php if ( $instance['thumb_as_link'] ) : ?>
                </a>
              <?php endif; ?>
			<?php endif; ?>
            <?php if ( $instance['show_title'] ) : ?>
			  <?php echo $instance["before_post_title"]; ?><a class="post-title" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php if ( $instance['show_title_date'] ) {?>[<?php the_time('m-d-Y'); ?>]<?php }else{?><?php the_title(); ?><?php }?></a><?php echo $instance["after_post_title"]; ?>
			<?php endif; ?>
            <div>
			  <?php if ( $instance['comment_num'] ) : ?>
                <div class="fright">(<?php comments_number(); ?>)</div>
              <?php endif; ?>
              <?php if ( $instance['date'] ) : ?>
                <div class="post_meta">Written by <?php the_author_posts_link() ?> <time datetime="<?php the_time('Y-m-d\TH:i'); ?>"><?php the_time('l, j F Y'); ?> <?php the_time() ?></time></div>
              <?php endif; ?>
            </div>
			<div class="post_content">
            <?php if ( $instance['excerpt'] ) : ?>
			  <?php if($limittext=="" || $limittext==0){ ?>
				  <?php if ( $instance['excerpt_as_link'] ) : ?>
                    <a href="<?php the_permalink() ?>">
                  <?php endif; ?>
                <?php the_excerpt(); ?>
				  <?php if ( $instance['excerpt_as_link'] ) : ?>
                    </a>
                  <?php endif; ?>
              <?php }else{ ?>
				  <?php if ( $instance['excerpt_as_link'] ) : ?>
                    <a href="<?php the_permalink() ?>">
                  <?php endif; ?>
                <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext);?>
				  <?php if ( $instance['excerpt_as_link'] ) : ?>
                    </a>
                  <?php endif; ?>
              <?php } ?>
            <?php endif; ?>
            </div>
			<?php if ($instance['posttype'] == "testi") { ?>
              <div class="name-testi"><span class="user"><?php echo $testiname; ?></span></div>
            <?php }?>
            <?php if ( $instance['more_link'] ) : ?>
              <a href="<?php the_permalink() ?>" class="<?php if($instance['more_link_class']!="") {echo $instance['more_link_class'];}else{ ?>link<?php } ?>"><?php if($instance['more_link_text']==""){ ?>Read more<?php }else{ ?><?php echo $instance['more_link_text']; ?><?php } ?></a>
            <?php endif; ?>
		</li>
	<?php } ?>
	<?php echo "</ul>\n"; ?>
	<?php if ( $instance['global_link'] ) : ?>
	  <a href="<?php echo $instance['global_link_href']; ?>" class="link_show_all"><?php if($instance['global_link_text']==""){ ?>View all<?php }else{ ?><?php echo $instance['global_link_text']; ?><?php } ?></a>
	<?php endif; ?>
	
<?php 	
	echo $after_widget;
	
	$post = $post_old; // Restore the post object.
}

/**
 * Form processing.
 */
function update($new_instance, $old_instance) {
	return $new_instance;
}

/**
 * The configuration form.
 */
function form($instance) {
?>
<p>
    <label for="<?php echo $this->get_field_id("title"); ?>">
        <?php _e( 'Title' ); ?>:
        <input class="widefat" id="<?php echo $this->get_field_id("title"); ?>" name="<?php echo $this->get_field_name("title"); ?>" type="text" value="<?php echo esc_attr($instance["title"]); ?>" />
    </label>
</p>
<div style="width:230px; float:left; padding-right:20px; border-right:1px solid #c7c7c7;">
  <p>
      <label>
          <?php _e( 'Posts type' ); ?>:
          <?php
          $args=array(
          );
          ?>
          <select id="<?php echo $this->get_field_id('posttype'); ?>" name="<?php echo $this->get_field_name('posttype'); ?>" class="widefat" style="width:150px;">
              <?php foreach(get_post_types($args,'names') as $key => $post_type) { 
			  
			  $label_obj = get_post_type_object($post_type); 
              $labels = $label_obj->labels->name;
			  ?>
              
              <?php if ($key=='page' || $key=='revision' || $key=='attachment' || $key=='nav_menu_item' || $key=='optionsframework'){continue;} ?>
              <option<?php selected( $instance['posttype'], $post_type ); ?> value="<?php echo $post_type; ?>"><?php echo $labels; ?></option>
              <?php } ?>
          </select>
      </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("num"); ?>">
          <?php _e('Number of posts to show'); ?>:
          <input style="text-align: center;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="text" value="<?php echo absint($instance["num"]); ?>" size='4' />
      </label>
</p>

<p>
  <label for="<?php echo $this->get_field_id("sort_by"); ?>">
  <?php _e('Sort by'); ?>:
  <select id="<?php echo $this->get_field_id("sort_by"); ?>" name="<?php echo $this->get_field_name("sort_by"); ?>">
    <option value="date"<?php selected( $instance["sort_by"], "date" ); ?>>Date</option>
    <option value="title"<?php selected( $instance["sort_by"], "title" ); ?>>Title</option>
    <option value="comment_count"<?php selected( $instance["sort_by"], "comment_count" ); ?>>Number of comments</option>
    <option value="rand"<?php selected( $instance["sort_by"], "rand" ); ?>>Random</option>
  </select>
      </label>
</p>
  
<p>
  <label for="<?php echo $this->get_field_id("asc_sort_order"); ?>">
  <input type="checkbox" class="checkbox" 
    id="<?php echo $this->get_field_id("asc_sort_order"); ?>" 
    name="<?php echo $this->get_field_name("asc_sort_order"); ?>"
    <?php checked( (bool) $instance["asc_sort_order"], true ); ?> />
          <?php _e( 'Reverse sort order (ascending)' ); ?>
      </label>
</p>
<p>
  <label for="<?php echo $this->get_field_id("comment_num"); ?>">
      <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("comment_num"); ?>" name="<?php echo $this->get_field_name("comment_num"); ?>"<?php checked( (bool) $instance["comment_num"], true ); ?> />
      <?php _e( 'Show number of comments' ); ?>
  </label>
</p>

<p>
  <label for="<?php echo $this->get_field_id("date"); ?>">
      <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("date"); ?>" name="<?php echo $this->get_field_name("date"); ?>"<?php checked( (bool) $instance["date"], true ); ?> />
      <?php _e( 'Show meta' ); ?>
  </label>
</p>

<p>
  <label for="<?php echo $this->get_field_id("container_class"); ?>">
    <?php _e( 'Container class' ); ?>:
    <input class="widefat" id="<?php echo $this->get_field_id("container_class"); ?>" name="<?php echo $this->get_field_name("container_class"); ?>" type="text" value="<?php echo esc_attr($instance["container_class"]); ?>" /> <span style="font-size:11px; color:#999;"><?php _e( '(default: "featured_custom_posts")' ); ?></span>
  </label>
</p>

  <fieldset style="border:1px solid #F1F1F1; padding:10px 10px 0; margin-bottom:1em;">
  <legend style="padding:0 5px;"><?php _e('Post title'); ?>:</legend>
  <p>
      <label for="<?php echo $this->get_field_id("show_title"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("show_title"); ?>" name="<?php echo $this->get_field_name("show_title"); ?>"<?php checked( (bool) $instance["show_title"], true ); ?> />
          <?php _e( 'Show post title' ); ?>
      </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("show_title_date"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("show_title_date"); ?>" name="<?php echo $this->get_field_name("show_title_date"); ?>"<?php checked( (bool) $instance["show_title_date"], true ); ?> />
          <?php _e( 'Date as title <span style="font-size:11px; color:#999;">("[mm-dd-yyyy]")</span>' ); ?>
      </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("before_post_title"); ?>">
          <?php _e( 'Before title' ); ?>:
          <input class="widefat" style="width:40%" id="<?php echo $this->get_field_id("before_post_title"); ?>" name="<?php echo $this->get_field_name("before_post_title"); ?>" type="text" value="<?php echo esc_attr($instance["before_post_title"]); ?>" />
      </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("after_post_title"); ?>">
          <?php _e( 'After title' ); ?>:&nbsp;&nbsp;
          <input class="widefat" style="width:40%" id="<?php echo $this->get_field_id("after_post_title"); ?>" name="<?php echo $this->get_field_name("after_post_title"); ?>" type="text" value="<?php echo esc_attr($instance["after_post_title"]); ?>" />
      </label>
  </p>

  </fieldset>

  <fieldset style="border:1px solid #F1F1F1; padding:10px 10px 0; margin-bottom:1em;">
  <legend style="padding:0 5px;"><?php _e('Excerpt'); ?>:</legend>
  <p>
      <label for="<?php echo $this->get_field_id("excerpt"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt"); ?>" name="<?php echo $this->get_field_name("excerpt"); ?>"<?php checked( (bool) $instance["excerpt"], true ); ?> />
          <?php _e( 'Show post excerpt' ); ?>
      </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("excerpt_length"); ?>">
          <?php _e( 'Excerpt length (words):' ); ?>
      </label>
      <input style="text-align: center;" type="text" id="<?php echo $this->get_field_id("excerpt_length"); ?>" name="<?php echo $this->get_field_name("excerpt_length"); ?>" value="<?php echo $instance["excerpt_length"]; ?>" size="3" />
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("excerpt_as_link"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt_as_link"); ?>" name="<?php echo $this->get_field_name("excerpt_as_link"); ?>"<?php checked( (bool) $instance["excerpt_as_link"], true ); ?> />
          <?php _e( 'Excerpt as link' ); ?>
      </label>
  </p>
  </fieldset>
</div>
<div style="width:230px; float:left; padding-left:20px;">
  <fieldset style="border:1px solid #F1F1F1; padding:10px 10px 0; margin-bottom:1em;">
  <legend style="padding:0 5px;"><?php _e('More link'); ?>:</legend>
  <p>
      <label for="<?php echo $this->get_field_id("more_link"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("more_link"); ?>" name="<?php echo $this->get_field_name("more_link"); ?>"<?php checked( (bool) $instance["more_link"], true ); ?> />
          <?php _e( 'Show "More link"' ); ?>
      </label>
  </p>
  
  <p>
  <label for="<?php echo $this->get_field_id("more_link_text"); ?>">
    <?php _e( 'Link text' ); ?>:
    <input class="widefat" id="<?php echo $this->get_field_id("more_link_text"); ?>" name="<?php echo $this->get_field_name("more_link_text"); ?>" type="text" value="<?php echo esc_attr($instance["more_link_text"]); ?>" /> <span style="font-size:11px; color:#999;"><?php _e( '(default: "Read more")' ); ?></span>
  </label>
  </p>
  <p>
  <label for="<?php echo $this->get_field_id("more_link_class"); ?>">
    <?php _e( 'Link class' ); ?>:
    <input class="widefat" id="<?php echo $this->get_field_id("more_link_class"); ?>" name="<?php echo $this->get_field_name("more_link_class"); ?>" type="text" value="<?php echo esc_attr($instance["more_link_class"]); ?>" /> <span style="font-size:11px; color:#999;"><?php _e( '(default: "link")' ); ?></span>
  </label>
  </p>
  </fieldset>
  <fieldset style="border:1px solid #F1F1F1; padding:10px 10px 0; margin-bottom:1em;">
  <legend style="padding:0 5px;"><?php _e('Thumbnail dimensions'); ?>:</legend>
  <?php if ( function_exists('the_post_thumbnail') && current_theme_supports("post-thumbnails") ) : ?>
  <p>
      <label for="<?php echo $this->get_field_id("thumb"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumb"); ?>" name="<?php echo $this->get_field_name("thumb"); ?>"<?php checked( (bool) $instance["thumb"], true ); ?> />
          <?php _e( 'Show post thumbnail' ); ?>
      </label>
  </p>
  <p>
          <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
              Width: &nbsp;<input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo $instance["thumb_w"]; ?>" />
          </label>
  </p>
  <p>
          <label for="<?php echo $this->get_field_id("thumb_h"); ?>">
              Height: <input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id("thumb_h"); ?>" name="<?php echo $this->get_field_name("thumb_h"); ?>" value="<?php echo $instance["thumb_h"]; ?>" />
          </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("thumb_as_link"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumb_as_link"); ?>" name="<?php echo $this->get_field_name("thumb_as_link"); ?>"<?php checked( (bool) $instance["thumb_as_link"], true ); ?> />
          <?php _e( 'Thumbnail as link' ); ?>
      </label>
  </p>
  </fieldset>
  <fieldset style="border:1px solid #F1F1F1; padding:10px 10px 0; margin-bottom:1em;">
  <legend style="padding:0 5px;"><?php _e('Link to all posts'); ?>:</legend>
  <p>
      <label for="<?php echo $this->get_field_id("global_link"); ?>">
          <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("global_link"); ?>" name="<?php echo $this->get_field_name("global_link"); ?>"<?php checked( (bool) $instance["global_link"], true ); ?> />
          <?php _e( 'Show global link to all posts' ); ?>
      </label>
  </p>
  <p>
  <label for="<?php echo $this->get_field_id("global_link_text"); ?>">
    <?php _e( 'Link text' ); ?>:
    <input class="widefat" id="<?php echo $this->get_field_id("global_link_text"); ?>" name="<?php echo $this->get_field_name("global_link_text"); ?>" type="text" value="<?php echo esc_attr($instance["global_link_text"]); ?>" /> <span style="font-size:11px; color:#999;"><?php _e( '(default: "View all")' ); ?></span>
  </label>
  </p>
  <p>
      <label for="<?php echo $this->get_field_id("global_link_href"); ?>">
          <?php _e( 'Link URL' ); ?>:
          <input class="widefat" id="<?php echo $this->get_field_id("global_link_href"); ?>" name="<?php echo $this->get_field_name("global_link_href"); ?>" type="text" value="<?php echo esc_attr($instance["global_link_href"]); ?>" />
      </label>
  </p>
  </fieldset>
</div>
<div style="clear:both;"></div>



		<?php endif; ?>

<?php

}

}
?>

Open in new window

0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38423372
In the code above you have to have specify the custom post type in the Loop construct:

look for instances of 'post_type' and change the value of that argument or variable to 'name you gave the custom post type'

I see one at line 35 in the snippet above.  There might be more.
0
 

Author Comment

by:designrox
ID: 38423590
If it was supposed to be specified wouldn't it show "portfolio" as the post_type since that's where it's pulling from? In the dashboard it gives you a drop down to select the post type so I thought post_type just meant that it pulled whichever item was selected in the widget dashboard. I hope that makes sense. I am not at all familiar with php but it doesn't look right to replace it with the home posts I made. Seems like it would have to be somewhere else. Please let me know if I am wrong. I am purely speculating. And I still am trying to figure this out. Thanks again for your help so far.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 38423595
No, that's more likely the normal post's categories.  The post type would simply be "post"
0
 

Author Comment

by:designrox
ID: 38423628
I just realized I posted the wrong code for the widget. Ugh. This is the correct code for the post cycle widget. And this is what I was referring to. Sorry!!

<?php
// =============================== My Post Cycle widget ======================================
class MY_CycleWidget extends WP_Widget {
    /** constructor */
    function MY_CycleWidget() {
        parent::WP_Widget(false, $name = 'My - Post Cycle');      
    }

    /** @see WP_Widget::widget */
    function widget($args, $instance) {            
        extract( $args );
        $title = apply_filters('widget_title', $instance['title']);
                        $limit = apply_filters('widget_limit', $instance['limit']);
                        $category = apply_filters('widget_category', $instance['category']);
                        $count = apply_filters('widget_count', $instance['count']);
        ?>
              <?php echo $before_widget; ?>
                  <?php if ( $title )
                        echo $before_title . $title . $after_title; ?>
                                    
                                    <?php if($category=="testi"){?>
                        <script type="text/javascript">
                                                      jQuery(function(){
                                                            jQuery('#testi-cycle').cycle({
                                                                  fx: 'scrollUp', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
                                                                  timeout: 8000,
                                                                  height: 'auto',
                                                                  prev:    '#prev-testi',
                                                                  next:    '#next-testi',
                                                                  pager:   '#nav-testi',
                                                                  pagerAnchorBuilder: pagerFactory
                                                            });
                                                            
                                                            function pagerFactory(idx, slide) {
                                                                        var s = idx > <?php echo $count; ?> ? ' style="display:none"' : '';
                                                                        return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
                                                            };
                                                      });
                                                </script>
                    <div class="testimonials" id="testi-cycle">
                                                
                                                <?php $limittext = $limit;?>
                                                <?php global $more;      $more = 0;?>
                                                <?php query_posts("posts_per_page=". $count ."&post_type=" . $category);?>
                                                
                                                <?php while (have_posts()) : the_post(); ?>      
                                                
                                                      <?php
                                                      $custom = get_post_custom($post->ID);
                                                      $testiname = $custom["testimonial-name"][0];
                                                      ?>
                                                
                                                <div class="testi_item">

                                                <?php if($limittext=="" || $limittext==0){ ?>
                                                      <?php the_excerpt(); ?>
                                                       <div class="name-testi">
                                                       <span class="user"><?php echo $testiname; ?></span>
                                                       </div>
                                                <?php }else{ ?>
                                                      <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext);?>
                                                       <div class="name-testi">
                                                       <span class="user"><?php echo $testiname; ?></span>
                   </div>
                                                <?php } ?>
                                                </div>
                                                <?php endwhile; ?>
                <?php wp_reset_query(); ?>
                                          </div>
              <div id="testi-controls">
                <a href="#"><span id="prev-testi"><?php _e('Prev', 'theme1564'); ?></span></a>
                <a href="#"><span id="next-testi"><?php _e('Next', 'theme1564'); ?></span></a>
                <ul id="nav-testi"></ul>
              </div>
                                          <!-- end of testimonials -->
             
            <?php } elseif($category=="slogans"){ ?>
          
          
          <script type="text/javascript">
                                                jQuery(function(){
                                                      jQuery('#slogan-cycle').cycle({
                                                            pause: 1,
                                                            fx: 'scrollHorz',
                                                            timeout: 6000,
                                                            prev:    '#slogan-prev',
                                                            next:    '#slogan-next',
                                                            pagerAnchorBuilder: pagerFactory,
                                                            easing: 'easeInOutCirc'
                                                      });
                                                      
                                                      function pagerFactory(idx, slide) {
                                                                  var s = idx > <?php echo $count; ?> ? ' style="display:none"' : '';
                                                                  return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
                                                      };
                                                });
                                          </script>
                    <div class="slogan_cycle" id="slogan-cycle">
                                                <?php $limittext = $limit;?>
                                                <?php global $more;      $more = 0;?>
                                                <?php query_posts("posts_per_page=" . $count . "&post_type=" . $category);?>
                                                <?php while (have_posts()) : the_post(); ?>
                                                
                                                <?php
                                                      $custom = get_post_custom($post->ID);
                                                      $customurl = $custom["custom-url"][0];
                                                      ?>
                                                
                                                <div class="cycle_item">
                                                    <?php if ($customurl!="") {      ?>
                                                      <h2><a href="<?php echo $customurl; ?>"><?php the_title(); ?><span class="border-bot"></span></a></h2>
                                                    <?php } else { ?>      
                                                      <h2><?php the_title(); ?></h2>
                                                    <?php } ?>      
                                                </div>
                                                <?php endwhile; ?>
                <?php wp_reset_query(); ?>
                                          </div>
                                          <div id="slogan-controls">
                <a href="#" id="slogan-prev"><?php _e('Prev', 'theme1564'); ?></a>
                <a href="#" id="slogan-next"><?php _e('Next', 'theme1564'); ?></a>
              </div>
                                          <!-- end of slogans -->
                                          
                                          <?php } elseif($category=="clients"){ ?>
                                          
                                          
                                          <script type="text/javascript">
                                                jQuery(document).ready(function(){
                                                      jQuery('#clients-cycle').tinycarousel({
                                                            interval: true,
                                                            intervaltime: 5000
                                                      });      
                                                });
                                          </script>
                                          
                                          <div class="clients_cycle" id="clients-cycle">
                                          
                                                      <a class="buttons next" href="#"><span></span></a>
                                                      <a class="buttons prev" href="#"><span></span></a>
                                          
                                          <div class="viewport">
                                                      <ul class="overview">
                                                <?php $limittext = $limit;?>
                                                <?php global $more;      $more = 0;?>
                                                <?php query_posts("posts_per_page=" . $count . "&post_type=" . $category);?>
                                                <?php while (have_posts()) : the_post(); ?>
                                                
                                                <?php
                                                      $custom = get_post_custom($post->ID);
                                                      $customurl = $custom["custom-url"][0];
                                                      ?>
                                                
                                                <li class="client_item">
                                                      <figure class="thumbnail"><a href="<?php echo $customurl; ?>"><?php the_post_thumbnail(); ?></a></figure>
                                                </li>
                                                <?php endwhile; ?>
                <?php wp_reset_query(); ?>
            </ul>
                                                </div>
                                          </div>
                                          <!-- end of clients_cycle -->
                                          
                                          
           
                                    <?php } elseif($category=="portfolio"){ ?>
                                          <div class="folio_cycle" id="folio-cycle">
                                                <?php $limittext = $limit;?>
                <?php global $more;      $more = 0;?>
                <?php query_posts("posts_per_page=". $count ."&post_type=" . $category);?>
                <?php while (have_posts()) : the_post(); ?>
            
            <?php $custom = get_post_custom($post->ID);
                        $thumb = $custom["custom-thumb"][0]; ?>            
            
                <div class="folio_item">
               <?php if ($thumb!='') { ?>
                <figure class="thumbnail"><img src="<?php echo $thumb; ?>" alt="" /><a href="<?php the_permalink(); ?>" class="link"><span><?php _e('view details','theme1564'); ?></span></a></figure>
               <?php } else { ?>
                <figure class="thumbnail"><?php the_post_thumbnail(); ?><a href="<?php the_permalink(); ?>" class="link"><span><?php _e('view details','theme1564'); ?></span></a></figure>
               <?php } ?>
                </div>
                <?php endwhile; ?>
                <?php wp_reset_query(); ?>
              </div>
              <!-- end of portfolio_cycle -->
           
                                    <?php } else { ?>
                                          
              <script type="text/javascript">
                                                jQuery(function(){
                                                      jQuery('#post-cycle').cycle({
                                                            pause: 1,
                                                            fx: 'fade',
                                                            timeout: 3500
                                                      });
                                                });
                                          </script>
                                          <div class="post_cycle" id="post-cycle">
                                                <?php $limittext = $limit;?>
                                                <?php global $more;      $more = 0;?>
                                                <?php query_posts("posts_per_page=" . $count . "&post_type=" . $category);?>
                                                <?php while (have_posts()) : the_post(); ?>      
                                                <div class="cycle_item">
                                                      <?php if($limittext=="" || $limittext==0){ ?>
                  <a href="<?php the_permalink(); ?>"><figure class="featured-thumbnail small"><?php the_post_thumbnail('small-post-thumbnail'); ?></figure></a>
                  <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                                      <?php the_excerpt(); ?>
                                                      <?php }else{ ?>
                  <a href="<?php the_permalink(); ?>"><figure class="featured-thumbnail small"><?php the_post_thumbnail('small-post-thumbnail'); ?></figure></a>
                  <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                                      <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext); } ?>
                                                </div>
                                                <?php endwhile; ?>
                <?php wp_reset_query(); ?>
                                          </div>
                                          <!-- end of post_cycle -->
                                          <?php }?>
              <?php echo $after_widget; ?>
        <?php
    }

    /** @see WP_Widget::update */
    function update($new_instance, $old_instance) {                        
        return $new_instance;
    }

    /** @see WP_Widget::form */
    function form($instance) {                        
                  $title = esc_attr($instance['title']);
                  $limit = esc_attr($instance['limit']);
                  $category = esc_attr($instance['category']);
                  $count = esc_attr($instance['count']);
    ?>
      <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'theme1564'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>

      <p><label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Limit Text:', 'theme1564'); ?> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label></p>
      <p><label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Posts per page:', 'theme1564'); ?><input class="widefat" style="width:30px; display:block; text-align:center" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo $count; ?>" /></label></p>

      <p><label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Show profile link:', 'theme1564'); ?><br />

      <select id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" style="width:150px;" >
      <option value="slogans" <?php echo ($category === 'slogans' ? ' selected="selected"' : ''); ?> >Slogans</option>
      <option value="clients" <?php echo ($category === 'clients' ? ' selected="selected"' : ''); ?> >Clients</option>
      <option value="testi" <?php echo ($category === 'testi' ? ' selected="selected"' : ''); ?>>Testimonials</option>
      <option value="portfolio" <?php echo ($category === 'portfolio' ? ' selected="selected"' : ''); ?> >Portfolio</option>
      <option value="" <?php echo ($category === '' ? ' selected="selected"' : ''); ?>>Blog</option>
      </select>
      </label></p>
       
      <?php
    }

} // class Cycle Widget


?>
0
 

Author Closing Comment

by:designrox
ID: 38434111
It pointed my in the right direction but I did not get the outcome I really wanted so I had to post an additional question after this one.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question