Wordpress or Php issue not sure

12 replies
Code:
 if($width != '' || $height != ''){
		    	if (get_the_post_thumbnail( $post->ID, array($width,$height),""  ) == '') { $ftrdimg = '<img src="'.get_template_directory_uri().'/images/slideshow/noftrdimg-1006x250.jpg" />'; } else { $ftrdimg = get_the_post_thumbnail( $post->ID, array($width,$height),"class={$reflect}" ); }
		    } else {
		    	if (get_the_post_thumbnail( $post->ID, array(756,250),""  ) == '') { $ftrdimg = '<img src="'.get_template_directory_uri().'/images/slideshow/noftrdimg.jpg" />'; } else { $ftrdimg = get_the_post_thumbnail( $post->ID, array(756,250),"class={$reflect}"  ); }
		    }
		    
			$tmp .='	<a class="reflect" href="'.$url.'">'.$ftrdimg.'</a>'. chr(13);
Here is just a little piece of what I got. It is a slider on the front page of my wordpress site. When there is a post with a featured picture it picks it and if not there is just a picture that says no picture on this post. The problem I am having is that when there is a picture that is small it is showing up left justified in the viewer slider thing. If it is a large picture no problem it takes up the whole slider if not its left justified. I am just trying to get these pictures to be centered in the viewer. Is this possible with what I have here? If there is anymore info you need let me know. Just getting back into internet marketing again. This is my first post after almost 3 years as a member but recently really liking warrior forum better than that other forum that many are probably familiar with.
Thanks
#issue #php #wordpress
  • Profile picture of the author lazypuppy
    Add aligncenter to this part:
    Code:
    <a class="reflect aligncenter" href="'..'">'..'</a>'. chr(13);
    And in your CSS, add this:
    Code:
    .aligncenter { 
    display: block;
    margin-left: auto;
    margin-right: auto; 
    }
    {{ DiscussionBoard.errors[6577061].message }}
  • Profile picture of the author seopress
    I'd first look to see if your theme has any thumbnail alignment settings in Theme Options.

    If not, you should be able to center the thumbnails with some css settings. But looks like you'll need to take account of the class applied to each thumb that is defined by the $reflect variable - at least to insure that this class does not interfere with other css settings.

    Regards,
    Dave Seldon
    {{ DiscussionBoard.errors[6577091].message }}
    • Profile picture of the author lazypuppy
      Originally Posted by seopress View Post

      I'd first look to see if your theme has any thumbnail alignment settings in Theme Options.

      If not, you should be able to center the thumbnails with some css settings. But looks like you'll need to take account of the class applied to each thumb that is defined by the variable - at least to insure that this class does not interfere with other css settings.

      Regards,
      Dave Seldon
      Yep, do this first, footballbob06.
      {{ DiscussionBoard.errors[6577105].message }}
  • Profile picture of the author footballbob06
    I didn't see any settings for thumbnails on the theme options. I also added the code to the php and the css and nothing happened they are still not centered. Any other Ideas?
    {{ DiscussionBoard.errors[6577452].message }}
  • Profile picture of the author seopress
    Is "$reflect" always equal to "reflect"? That might be a problem, I can't really tell. (But I'm far from a PHP or css expert ... can you send the url to the problem page?

    Regards,
    Dave Seldon
    {{ DiscussionBoard.errors[6577610].message }}
  • Profile picture of the author footballbob06
    I would but I dont have enough posts. Anything I can do?

    I havent written anything just some samples trying to get the setup correct before I write any content. I also took out the code that lazypuppy had given me to try.

    You will see if you look at the picture of the truck or the e-book it shows up on the left of the slide viewer.
    Thanks
    {{ DiscussionBoard.errors[6577721].message }}
  • Profile picture of the author seopress
    Guess I'm blind or stupid but I don't see the url to your site anywhere, can you tell me?

    Regards,
    Dave Seldon
    {{ DiscussionBoard.errors[6577795].message }}
  • Profile picture of the author footballbob06
    beattheend

    It is that with a .com. It wouldnt let me post it cuz I don't have enough post count. Hopefully i don't get in trouble.
    {{ DiscussionBoard.errors[6577835].message }}
  • Profile picture of the author seopress
    Try placing following in style.css;

    Code:
    .ui-tabs-nav-item img, img.attachment-slider-thumbnail {
    display: block;
    margin-left: auto;
    margin-right: auto; 
    }
    Regards,
    Dave Seldon
    {{ DiscussionBoard.errors[6578017].message }}
    • Profile picture of the author lazypuppy
      I see that you are using Custom Community theme.

      You could try going to Theme Settings under Appearance in the WordPress back end. Then under Slideshow, change Slideshow Style to full width.

      If that doesn't work, you need to add aligncenter to the image somehow. This code below will center the image.

      Code:
      <img src="beattheend.com/wp-content/uploads/2012/07/spiralcover-200x250.jpg" class=" wp-post-image aligncenter" alt="spiralcover" title="spiralcover" height="250" width="200">
      Other than that, you may want to ask for support from the theme maker - wordpress.org/extend/themes/custom-community.
      {{ DiscussionBoard.errors[6578294].message }}
  • Profile picture of the author footballbob06
    This is really proving to be a pain. That didn't work either.
    {{ DiscussionBoard.errors[6578212].message }}
  • Profile picture of the author jaasmit
    If you do not feel comfortable with this solution then try to install any plugins that will give you the opportunity to do exactly that.
    {{ DiscussionBoard.errors[6612661].message }}

Trending Topics