Support Forum

Is it possible to do a span?

BM Bill Murray
Bill Murray
Member

Is it possible to something like a span by modifying the parameters of something like sp_PostIndexUserStatus?

I would like to display the status after a user’s name on the same line.

Update: that was actually a stupid question to ask.  So let me change it to a better one:

Can sp_PostIndexUserDate be used to add a label using _SP, like:

sp_PostIndexUserDate(‘tagClass=spPostUserDate&stackdate=0 spLeft’, __sp(‘Last Visit: %DATE%’));

That doesn’t seem to work and I haven’t yet gone on a search for the function.

16 Answers

New Answer

MP Mr Papa
Mr Papa
Member

still not sure I follow you…

where are you wanting to do this? everywhere there is a user name displayed? or specific location?

you can ‘concatenate’ two template tags if you like by doing them one after the other… if you change both container divs to have style of display:inline they will appear next to each other…

BM Bill Murray
Bill Murray
Member

I am going for the “stacked” look for a wider content area.  It fits my long-winded tendencies better laugh

http://www.wpperform.com/forums/pre-sales-questions/problem-with-post-edit-buttonow-do-plugins-work/

In the spInfoSection, I want to add Last Visit: before the date of the last visit.  But doing that to sp_PostIndexUserDate using an approach similar to other functions doesn’t work, as you can see on the link.  The date displays, but no label.

Does that clarify?

YS Yellow Swordfish
Yellow Swordfish
Member

The sp_PostIndexUserDate() template tag has no label parameter so your first notion will never work.

But in the actual templat where you make the call you can place any php or html anywhere you want it. So at the most basic you could do something like:

echo ‘Last Post ‘ . sp_PostIndexUserDate(‘get=1’);

as an example.

BR Brandon
Brandon
Member

I would start by going back to the SP supplied stacked theme and looking in spTopicView.php and see how it is done there.

IE:

 

sp_ColumnStart(‘tagClass=spInfoSection spLeft&width=30%&height=60px’);
 sp_SectionStart(‘tagClass=spLeft’, ‘user-dates’);
 echo ‘<span class=”spPostUserDate”>’.__sp(‘Last Visit’).’: </span>’;
 sp_PostIndexUserDate(‘tagClass=spCenter spPostUserDate&stackdate=0’);
 sp_PostIndexUserRegistered(‘tagClass=spPostUserRegistered spCenter’, __sp(‘Member Since: %DATE%’));
sp_PostIndexUserPosts(‘tagClass=spPostUserPosts spCenter’, __sp(‘Forum Posts: %COUNT%’));

sp_SectionEnd(”, ‘user-dates’);

sp_ColumnEnd();

 

You can then move the info around, up down or change the width of that column as needed to match your layout.

The code shown should show you something like this which sounds like what you are wanting.

Last Visit: December 19, 2011 – 9:03 pm

Member Since: September 12, 2011

Forum Posts: 10

From there you could add this just about anywhere in spTopicView.php

echo ‘<span class=”spPostUserDate”>’.__sp(‘Last Visit’).’: </span>’;

 sp_PostIndexUserDate(‘tagClass=spCenter spPostUserDate&stackdate=0’);

BM Bill Murray
Bill Murray
Member

@Yellow Swordfish, Without making a lot of changes to the CSS, that didn’t quite work. 

@Brandon, Thanks for the suggestion.  I had already looked at other samples.  My question was not so much about how to display the date as to how to position it.

It turns out my problem was the extra markup added by sp_SectionStart and spSectionEnd.  If I kept all of the code with a sp_ColumnStart and sp_ColumnEnd, I am fine.  You can see the work in progress here:

http://www.wpperform.com/forums/pre-sales-questions/where-can-i-find-info-on-plans-and-pricing/

BM Bill Murray
Bill Murray
Member

Thanks, Yellow Swordfish.

Btw, I was using the css only theme as a starting point.  You may want to check on that theme’s css-only.css:

Line 383 – inherit is mis-spelled as inheit, which causes the intended font family selection to break

Line 1892 – double ; at the end

I’ve made a lot of changes since your last post.  I’m not 100% done, and I have not tested options or settings which I have disabled.  Any feedback, particularly in the area of readability, is appreciated.

MP Mr Papa
Mr Papa
Member

corrections made in css only theme… thanks…

feedback?  too much white space and not enough borders… kisstwistedeekcool

just kidding…  looking good…  will add one thing though… the text labels (and image) in your buttons seem to have dropped a few pixels and are not centered vertically…

BM Bill Murray
Bill Murray
Member

I’ve been taking a quarter out of jar for every 1px of border I remove.  Pretty soon I’ll be calling you.  I’ll have enough to go on a nice cruise.  laugh

Good eye for picking up on the buttons.  The buttons are 1 area where I haven’t spent much time.  The jury is still out on whether I should use CSS gradients on them.  My quick take is that CSS gradients can work over bigger spaces, but in small ones, handcrafted gradients from Photoshop look better.  I also want to make that consistent with my overall theme.  SPF has the most buttons in one place, so I’ll figure out my preference on the forum and let that carry the day elsewhere.

BM Bill Murray
Bill Murray
Member

Ok, I have hit a small stumbling block and would appreciate some advice/direction …

It appears that #spMainContainer .spHeaderName inherits its font from the theme’s body style.  I was thinking that (conceptually) this should be from one of the heading styles, H1-H6.  So, I added <h1> tags as:

echo ‘<h1>’;

sp_GroupHeaderName(‘tagClass=spHeaderName’);

echo ‘</problem-with-post-edit-button1>’;

That works. But this does not:

echo ‘<h1>’ . sp_GroupHeaderName(‘tagClass=spHeaderName’) . echo ‘</problem-with-post-edit-button1>’;

Is there a reason why the 2nd does not work?

If I understand your CSS flow, first you reset everything with reset.css, then you customize it.  On line 14 of reset.css, the font-family is set to inherit.  With that setting, my <h1> inherits my body font.  Taking that out, it inherits my theme’s <h1> font, which I want. 

I want to avoid hard-coding a font in the theme’s style sheet for that ID.  Should I just edit reset.css and remove inherit?  Or edit reset.css and remove the ID from the big list of those covered by line 14?  Or is there a better way to get the theme’s <h1> to pass down?

MP Mr Papa
Mr Papa
Member

second would be:

echo ‘<h1>’ . sp_GroupHeaderName(‘tagClass=spHeaderName’) . ‘</problem-with-post-edit-button1>’;

dont ‘echo’ twice…

h1 inherited the body font?  would have to think about how thats happening…  would have thought it would inherit the h1…

I have been thinking about just removing the font-family from the reset… 

BM Bill Murray
Bill Murray
Member

Thanks.  Stupid me on the echo.  However, with your correction, it outputs the header name, then outputs empty <h1> tags after that.  I can’t see how that could be happening.

You can see it on my forum page.  I’ll leave it there for a little bit.  Then I might just comment out the font-family in the reset on the line I referenced, and see how it does.

MP Mr Papa
Mr Papa
Member

sorry, wasnt rally paying attention to ‘what’ you were doing…

echo ‘<h1>’ . sp_GroupHeaderName(‘tagClass=spHeaderName&echo=0’) . ‘</problem-with-post-edit-button1>’;

MP Mr Papa
Mr Papa
Member

or

echo ‘<h1>’ . sp_GroupHeaderName(‘tagClass=spHeaderName&get=1’) . ‘</problem-with-post-edit-button1>’;

if you dont want the div tags too…