Jump to content


Photo
- - - - -

Add CSS code in the content area?


Best Answer Rob , 26 December 2012 - 10:03 PM

Your code is a PHP script, not CSS, so that would require a hook.  Hooks can't, to my knowledge, be included inside a post or page content, but can be added before or after the loop.  I'm no expert in this.  But the easiest solution here would be to use the Action Plugin (free in the Store) to identify where you wish to place the code, and what relevant hooks exist there.  Then, our new premium plugin called Hooker, could be used to implement the code in that hook. 

 

The Hooker plugin is also available in the store.

 

Another option might be the use of Shortcode Exec PHP, a free plugin.  http://wordpress.org...tcode-exec-php/

 

This allows you to implement the PHP script via the plugin, and provides you the opportunity to write a unique shortcode (title) for it.  You then implement the shortcode where you'd like.

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 patriknordkvist

patriknordkvist

    Advanced Member

  • Members
  • 30 posts
  • Framework Version:2.3.7
  • Country: Country Flag

Posted 26 December 2012 - 09:00 PM

I am trying to add some CSS code in the content area but get no effect.

 

For example when I add

 


php echo “Recent Posts:“; ?>
<ol>
php get_archives(‘postbypost’, ’5?, ‘custom’, ‘

 

  • ’, ‘

’); ?>
< /ol>
 

 

 

 

I get text, instead of the recent post

 

 

php echo “Recent Posts:“; ?>

    php get_archives(‘postbypost’, ’5?, ‘custom’, ‘
    •’, ‘

    ’); ?>

on the page



#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 26 December 2012 - 09:31 PM

CSS does not go into a content area unless you mean you want that code to display as instructions for example.

 

To display code, you wrap the code inside code tags. See this for reference:

Please Login or Register to see this Hidden Content



#3 patriknordkvist

patriknordkvist

    Advanced Member

  • Members
  • 30 posts
  • Framework Version:2.3.7
  • Country: Country Flag

Posted 26 December 2012 - 09:53 PM

If I want to add code, not for show, were do I add it to affect the content module area?



#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 26 December 2012 - 10:03 PM   Best Answer

Your code is a PHP script, not CSS, so that would require a hook.  Hooks can't, to my knowledge, be included inside a post or page content, but can be added before or after the loop.  I'm no expert in this.  But the easiest solution here would be to use the Action Plugin (free in the Store) to identify where you wish to place the code, and what relevant hooks exist there.  Then, our new premium plugin called Hooker, could be used to implement the code in that hook. 

 

The Hooker plugin is also available in the store.

 

Another option might be the use of Shortcode Exec PHP, a free plugin. 

Please Login or Register to see this Hidden Content

 

This allows you to implement the PHP script via the plugin, and provides you the opportunity to write a unique shortcode (title) for it.  You then implement the shortcode where you'd like.