Jump to content

Archived

This topic is now archived and is closed to further replies.

magichew

Calling Wordpress Functions in DMS text areas

Recommended Posts

magichew    2
magichew

I find myself duplicating the title of my Wordpress page titles in my Highlight and Hero sections and such.

 

It would be very convenient to be able to put the wordpress function, 'the_title' in there and make a template from it, that way I wouldn't need to type it again every time.

 

Is this something that is possible?

Share this post


Link to post
Share on other sites
magichew    2
magichew

Excellent. This is exactly what I wanted! Thank you.

Share this post


Link to post
Share on other sites
Rob    547
Rob

Sometimes... not often enough... I get it right :D

 

Glad to have helped!


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
sheilahoff+    63
sheilahoff

Hmmm...so then shouldn't I also be able to put the code for a year in the footer text box for copyright? It's not working:

 

Copyright &#169;<?php print(Date("Y")); ?

 

Is there a way to make this also work? I don't want to have to manually update the year every year.


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites
magichew    2
magichew

Hmmm...so then shouldn't I also be able to put the code for a year in the footer text box for copyright? It's not working:

 

Copyright &#169;<?php print(Date("Y")); ?

 

Is there a way to make this also work? I don't want to have to manually update the year every year.

 

sheilahoff

 

You wouldn't do it like that.

 

You need to use the plug in to create a short code for the date. Then you use the short code generated by the plugin (it can be whatever you want e.g. [the_date], [the_year] etc.) and then you type Copyright [the_year] where ever you wanted to to appear.

  • Like 1

Share this post


Link to post
Share on other sites
sheilahoff+    63
sheilahoff

Thanks. I"m trying that now but so far not quite getting it. I don't know coding. But I have the plug-in installed. Can you tell me what exactly to put in the php box?
I tried php print(Date("Y")); as it said not to use the <?php and ?> tags. Then I named it copyright_year and put [copyright_year] in the text box I also tried [shortcode arg="copyright_year"] to no avail. Clearly I don't know what I'm doing! Thanks for the assist.


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites
magichew    2
magichew

Sorry. I don't think the_date can be used like that. I doesn't get today's date. I gets the date from the meta date of the post or page the function has been called on. Not sure if there is a function for what you're after.

Share this post


Link to post
Share on other sites
sheilahoff+    63
sheilahoff

There SHOULD be a way to do this. This code Copyright &#169;<?php print(Date("Y")); ?> absolutely displays the current YEAR which is what one wants in the footer. This isn't about the date of a post. I have successfully used that very code in the footer of several websites done in Headway. I just don't know how to make it work in DMS.


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites
magichew    2
magichew

Sorry. I don't think the_date can be used like that. I doesn't get today's date. I gets the date from the meta date of the post or page the function has been called on. Not sure if there is a function for what you're after.

 

There is...

 

Put this in your short code box and delete the parts that you don't need.

 

echo date('l jS F Y');

 

If that doesn't work, drop the echo.

  • Like 1

Share this post


Link to post
Share on other sites
sheilahoff+    63
sheilahoff

BINGO! You're brilliant magichew! With that date in the plug-ins code box all I had to do was add [copyright_year] where I want the year in the footer! YAY! That was worth the price of admission! thank you so much!


Sheila Hoffman | Hoffman Graphics | Seattle

Share this post


Link to post
Share on other sites

  • Similar Content

    • tuciudadenred
      By tuciudadenred+
       
      I have problems with the scroll, someone who can help me?
      Video_1487265541.wmv
    • Simon
      By Simon
      WordPress 4.7.1 was released on 11th January.
      It introduced a new bug that stops certain filetypes from being uploaded.
      This bug unfortunately stops users from uploading SVGs with the Platform 5 builder.
      In the meantime if you need to upload an SVG or have any other image upload issues then please try this plugin that bypasses the mime checks that were introduced.
      https://wordpress.org/plugins/disable-real-mime-check/
       
      Link to trac ticket: https://core.trac.wordpress.org/ticket/39550
      EDIT: 4.7.2 has been released without the fix. Fix is now slated for 4.7.3
    • BentleyD
      By BentleyD+
      Hey Everyone,
       
      Ever since the latest wordpress update, woocommerce will not display the product images. When you click where they should be they pop up in a light box, but otherwise are not visible. The errors appear to be theme related. Is there an update or fix for this?
       
      http://legalizedshop.com/product/legalized-t-shirt/
      @James B @batman
    • Thijs
      By Thijs+
      Hi,
      I am using the plugin WP-Property with an addon called "WP Property Supermap".
      Testwise I've added the shordcode [supermap] to
      the post loop a embed section a text section The supermap is located as third after the H1 and H2 tags but the map gets displayed at the top of the page, 
      All three ways break up the page structure of all content which is above the supermap.
      My question is: Where is the error?  Is it the plugin or the theme which causes the display errors?
    • fancoder
      By fancoder+
      Just installed a new wordpress cms and loaded PL5 and the plugin I now notice that the menu custom link option is not opening. Also I am unable to access PageLine settings to configure the Sign Up plugin. Any ideas?
×