Wordpress and Webdesign Forum go41 » WordPress Code Snippets

  1. omerkhan02
    Member

    Joern,

    1) I am actually using the Tv Lost theme and the index.php file is as such.

    Can you please tell me where I would put your code:

    <?php $values = get_post_custom_values("Image"); if (isset($values[0])) { // checks for custom field Image and shows it if there is ?>
    " rel="bookmark" title="<?php the_title(); ?>">
    <img src="<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" class="alignleft post_thumbnail" width="200px" height="160px" />

    <?php } ?>

    Within this new index.php file. Can you show me what code I would replace with the above code.

    <?php get_header(); ?>

    <div id="left_side">

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div class="post">
    <div class="mpart">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?> </h2>

    <div class="entry">
    <?php the_excerpt(); ?>

    <?php $values = get_post_custom_values("Image"); if (isset($values[0])) { // checks for custom field Image and shows it if there is ?>
    " rel="bookmark" title="<?php the_title(); ?>">
    <img src="<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" class="alignleft post_thumbnail" width="200px" height="160px" />

    <?php } ?>
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <div class="info"> <span class="time"> <?php the_time('F jS, Y') ?> </span> <span class="category"> <?php the_category(', ') ?> </span>
    <span class="comments"> <?php comments_popup_link('0 Comment', '1 Comment', '% Comments'); ?> </span>
    </div>

    </div>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
    </div>

    <?php else : ?>
    <div class="mpart">
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
    </div>
    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    2) When I try to write an excerpt, the excerpt shows but I get a blue error image that says "Sorry no image for this property" . I think this is part of the realpress realestate plug in I am using. When I disable this plug in, the error message disappears. I can write the content and use the <read more> stuff to cut off the content and create a link to the entire post, but I am wondering why when I write an excerpt just by putting

    <?php the_excerpt(); ?> this horrible blue message occurs. There is some conflict with the real press plug in, I guess.

    Wondering if you can see what this could be

    2. I want to make the social media icons that are in a div called socialmedia align right on the same vertical plane as the class menu.

    Now what I was thinking was putting both of them in a div and floating one to the left and the other to the right. Will that keep them on the same plane? Right now as you can see the social icons are below the menu bar.

    3) I want to move the search properties box right next to the Featured content gallery slider, however I can't find the code or it. If I go to "view source"

    I can see that the class it is in is rs

    Here is the CSS syntax

    .right_side .rs {
    float: right;
    width: 205px;
    margin:0 5px;

    Should create a top-margin: 10px;

    So it moves up? Can we do that

    4) My clients current site is this:

    As you can see the top logo.jpg is place on top of another image which is logo)_bg.jpg.

    Now, what I was thinking of doing was to create a div

    and then have the background be the logo_bg and have it no repeat.

    How can I put the logo.jpg image on top of that, do I need a z index setting?

    In other words, in a div

    if you have the background be an image, how can you add another image superimposing or being displayed on top of the background image.

    After I get these answer, we are done ! Thanks so much man!

    Omar

    Posted 1 year ago #
  2. 1.
    the code is in the right place - inside the loop.
    To make it show something the post needs a custom field "Image" and in the value an image path as explained.
    BUT you have the_excerpt above the image and the_content below, that's working but shows part of the content twice.

    2)
    the blue error image comes for sure from the plugin, I think it's not 'horrible', that's the default image of the plugin if it can't get an image - I have no idea how this plugin works or how you are supposed to supply it with an image..

    2. ;-)
    do I really have to search your older posts for a link to the site you talk about?
    in this index.php I can not see a call to social media, so I gues you use a plugin inserting itself after the content. Most plugins you can disable auto-insert and use a php code in your template instead...

    3. site?

    4. if you load a background image via css and the logo image in header.php it will be on top of the "background"
    so background is by default behind, images you load in templates will be over it.
    to duplicate the clients logo you could make a 'print screen', resize the logo part to the size you need and load just in header.php. It will look exactly the same, including the phone number...

    Posted 1 year ago #
  3. omerkhan02
    Member

    you can see the site here:

    Also my user is admin
    password is :Digital or Ironman21

    I am still waiting for you to answer 2 questions.

    1. How to make the social media icons which are in a div called socialmedia at the same vertial plan as the navbar . They are lower and on the right. I know you have to make them float to the otherside of each other right?

    Also, I want to make the search properties box move up next to the slider or featured content gallery slider. how would I do that using CSS.

    I found a way around the blue box. It only happens if I use an excerpt. I will use content and use <read more> from the post to cut off the content. If I do this, the blue box doesn't appear but only when I display excerpt from post I write using the post editor. SOmehow the bluebox to replace lack of image is from the plugin realpress and I spoke with the owner who sounds like a dumbass, as he doesn't know how ot resolve the conflict. You should know how your things work or what bugs will be produced before releasing it to the market. Luckily I got an open source version.

    Posted 1 year ago #
  4. omerkhan02
    Member

    Joern, I got the social icons to go on the same plane. As you see there are two instances of them, both were in a div called "SOCIALMEDIA" SO THE SECOND ONE, THAT WAS BELOW THE NAV BAR, I RENAMED THE DIV SOCIALMEDIA1 AND THAT CAUSED THEM GO SHIFT UPWARD. HOW IS THIS SO? THAT IS GREAT BUT I want to understand how this amazing thing happened. Now I just want to put some space between the div elements, is that done with padding?

    Here is what I got from the original div

    #socialmedia1{

    width: 400px;

    float: right;

    margin-top: 10px;

    margin-right: -10px;

    margin-bottom: 0pt;

    margin-left: 0pt;

    text-align: right;

    padding:5px;

    }

    #socialmedia1 img { margin: 0 4px; }

    I guess this tells the images to be spaced by 4 px, right?

    It is still not spacing the images? I want to add some space between each social icon image. Also, as you can see the icons are hitting the bottom right corner of the slideshow window pane. How do yo move them down.

    They are in a div called "content" so I tried increasing margin-top but it is not going down. Any advice?

    Lastly, I want to shift my search box up right next to the Featured Content gallery slider. It is in a CSS selector called rs

    Here is the CSS syntax

    .right_side .rs {
    float: right;
    width: 205px;
    margin:0 5px;

    Should I create a top-margin: 10px;

    So it moves up? Can we do that

    Omar

    Posted 1 year ago #
  5. your socialmedia1 went up because as sicialmedia there is a width:400px; which doesn't fit beside the menu which has 600px already.
    because you do not have any style for #socialmedia1 in your stylesheet, I cant 'play' with it..
    try this first:

    #socialmedia1{
    text-align: right;
    }
    #socialmedia1 img {
    margin: 0 2px;
    }
    this tells the images spaced left and right 2px each - you might not have enough space else.

    It is not possible to move a sidebar widget beside your featured stuff.
    make a new div id (searchrentals), put all stuff you have in the widget code into this new div.
    put this new div id="searchrentals" in your template (header.php?) after the featured and before just before div class menu.

    now let #featured float left and add also #searchrentals in stylesheet, it should come beside without any style yet

    Posted 1 year ago #
  6. omerkhan02
    Member

    Joern, I understand that no matter what you do within the sidebar.php file, it will remain on the right due to the div. You need to put the php code and div for the real estate search form up where the div is that contains the slider and float the slider to the left in div =featured or something like that, usually in the header. php file.

    However, I did what you said for the social icons, and still they are not being spaced.

    Once again, here is a link to my site

    user: admin
    pass: Digital1

    Posted 1 year ago #
  7. as you might see yourself with firebug, the #socialmedia is not recognized somehow.

    you got a missing '}' here in default css
    ....
    a {
    color : #369;
    text-decoration:none;
    }
    /*
    ADDED A '}' above, you do not have!!!
    */

    #socialmedia1 {
    ....

    about the search, you are right, I do not know a way how to bring a div loaded in sidebar to display in an another place (there is only a way to fix it somewhere relative to the screen)

    Posted 1 year ago #
  8. omerkhan02
    Member

    I Jorge that worked. After putting the closing } it worked by adding the spaces however the socialicons1 div was moved down about 20 px from the menu bar and i couldn't figure out why, but when I used Firebug I found out that the width of the menu bar was extending over the first social icon and bringing the whole div down, so I reduced the width and now they are perfectly aligned with the menu bar.

    However, how do I move the social media div to the right a bit more so it gets closer to the blue background?

    Is that by using margin-right: 20px
    or align:right:

    for aligning the div within the page?

    Nevermind I figured it out. I used text-align:right;

    Thanks man

    Omar

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Join us! or log in (lost password?):