You are not logged in or registered. Please login or register to use the full functionality of this board...

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Headspace 2 custom
01-03-2011, 06:33 PM
Post: #1
Headspace 2 custom
I am using headspace 2 and I want to add additional before my title using the Customdata and am having trouble with the php.

I do not want to add a space between the custom text and the site name if I am not going to use it for example. (the custom data is: 'pre-name')

pre-name: How To
Site Name: Get Rich
Page Title: The Easy Way

Using the code below,

<title>
<?php echo MetaData::get_custom ('pre-name'); ?>&nbsp;<?php echo ($description = get_bloginfo('description')) ? $description : bloginfo('name'); ?><?php echo ($title = wp_title(false, 'right')) ? $title : ''; ?>
</title>

Will display this Title:

"How To Get Rich The Easy Way"

But in some posts, I do not want to add a pre-name I will get this:

pre-name:
Site Name: Get Rich
Page Title: The Easy Way

" Get Rich The Easy Way"

Does anyone know how to fix this:
<?php echo MetaData::get_custom ('pre-name'); ?>&nbsp;

that is to make the 'prename' and &nbsp; conditional (if I put in a pre-name and space it will display, but if I choose not to have a pre-name it will not display anything including the space)


I hope I explained this well enough.

Thanks in advanced.
Find all posts by this user
Quote this message in a reply
01-03-2011, 07:19 PM
Post: #2
RE: Headspace 2 custom
So from what understand you don't want to have this little space that appears when you don't use the pre-name field, is this correct?

The space is built into the code. So if you want to control when to have the space and when not to have it first you need to remove "&nbsp;" from the title code, and manually place it inside the pre-name field whenever you use it. Does this make sense?

So you will be writing this when you use the pre-name field:

pre-name: How To&nbsp;
site name: Get Rich
page name: The Easy Way

Should display this title:
"How To Get Rich The Easy Way"

Your pretty much moving "&nbsp;" from the code and manually placing it when you need it.

Good Luck
Nik

Have you become an employee to your own business by chasing first page google rankings on a daily basis? Start working on your business, NOT in it. Free your time with a completely hands-free SEO solution. Read the incredible member testimonials, and ask any questions you like.
Visit this user's website Find all posts by this user
Quote this message in a reply
Thank given by sigmast
01-03-2011, 08:31 PM
Post: #3
RE: Headspace 2 custom
Haa

I did not even think of doing it manually.

I was just trying to reduce anything that was not being used.

I was trying to code it with a conditional 'if' but this works too.

I think I was just suffering from tunnel vision.

Thanks for the quick reply.
Find all posts by this user
Quote this message in a reply
01-03-2011, 08:45 PM
Post: #4
RE: Headspace 2 custom
You're welcome Smile

Have you become an employee to your own business by chasing first page google rankings on a daily basis? Start working on your business, NOT in it. Free your time with a completely hands-free SEO solution. Read the incredible member testimonials, and ask any questions you like.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2011, 09:57 AM
Post: #5
RE: Headspace 2 custom
I have a similar question. How do we code conditional custom fields in our themes for Headspace2? I tried editing the code that should be used for Wordpress in general to fit the one used for Headspace2 but it didnt work. Keep in mind that I'm a beginner and I know that what I am about to post is TOTALLY wrong since it says get_post_meta where it probably should say get_custom but I dont even know where to start. Could someone edit it for me or tell me how to do it? Any help would be GREATLY appreciated!! I have this:

PHP Code:
<?php if(get_post_meta($post->ID'Name'true) || 
     
get_post_meta($post->ID'Stagename'true) || 
         
get_post_meta($post->ID'Dateofbirth'true) || 
         
get_post_meta($post->ID'Hometown'true) || 
     
get_post_meta($post->ID'Claimtofame'true)
     ): 
?>

    <ul>
        <?php if(get_post_meta($post->ID'Name'true)): ?>
        <li><strong>Name:</strong><?php echo MetaData::get_custom ('Name'); ?></li>
        <?php endif; ?>

        <?php if(get_post_meta($post->ID'Stagename'true)): ?>
        <li><strong>Stage Name:</strong><?php echo MetaData::get_custom ('Stagename'); ?></li>
        <?php endif; ?>

        <?php if(get_post_meta($post->ID'Dateofbirth'true)): ?>
        <li><strong>Date of Birth:</strong><?php echo MetaData::get_custom ('Dateofbirth'); ?></li>
        <?php endif; ?>

                <?php if(get_post_meta($post->ID'Hometown'true)): ?>
        <li><strong>Hometown:</strong><?php echo MetaData::get_custom ('Hometown'); ?></li>
        <?php endif; ?>

                <?php if(get_post_meta($post->ID'Claimtofame'true)): ?>
        <li><strong>Claim to Fame:</strong><?php echo MetaData::get_custom ('Claimtofame'); ?></li>
        <?php endif; ?>
    </ul>

<?php endif; ?>

PLEASE HELP!! Huh
Find all posts by this user
Quote this message in a reply
03-07-2011, 03:28 PM
Post: #6
RE: Headspace 2 custom
I'm somewhat a beginner on this as well, since i haven't played around with it too much. Can you please clarify on exactly what it is that needs to happen.

Nik

Have you become an employee to your own business by chasing first page google rankings on a daily basis? Start working on your business, NOT in it. Free your time with a completely hands-free SEO solution. Read the incredible member testimonials, and ask any questions you like.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2011, 05:31 PM
Post: #7
RE: Headspace 2 custom
Sure! What needs to happen is: I'm doing profiles on different famous people. Say for instance William Shakespeare. The Name value would be "William Shakespeare". However he doesnt have a Stage Name he is simply known as William Shakespeare. So I would need that field to be conditional(displayed only if a value is given & in this particular case no value will be). In Wordpress, conditional statements are generally done like

PHP Code:
<?php if(get_post_meta($post->ID'books'true) || 
     
get_post_meta($post->ID'music'true) || 
     
get_post_meta($post->ID'sites'true)
     ): 
?>

    <ul>
        <?php if(get_post_meta($post->ID'books'true)): ?>
        <li><?php echo get_post_meta($post->ID'books'true); ?></li>
        <?php endif; ?>

        <?php if(get_post_meta($post->ID'music'true)): ?>
        <li><?php echo get_post_meta($post->ID'music'true); ?></li>
        <?php endif; ?>

        <?php if(get_post_meta($post->ID'sites'true)): ?>
        <li><?php echo get_post_meta($post->ID'sites'true); ?></li>
        <?php endif; ?>
    </ul>

<?php endif; ?>

So my question is what in the above code would need to be changed to get it to work for the Headspace2 custom fields bc the format of the Headspace2 code is different from the basic Wordpress code used to call the custom field.

In Wordpress you display values of a specific key like:
PHP Code:
<?php echo get_post_meta($post->ID'books'true); ?>

In Headspace its like:
PHP Code:
<?php echo MetaData::get_custom ('books'); ?>

So the conditional statement would need to be edited accordingly yes? Or am I going about it all the way wrong?
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Get a pretty custom web design PaigePhil 0 1,015 07-23-2010 12:48 PM
Last Post: PaigePhil
  Please help with HeadSpace manolo 8 2,089 03-28-2010 05:46 AM
Last Post: CarlosAmigos

Forum Jump:


User(s) browsing this thread: 1 Guest(s)