Archived

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

  • 0

Add CSS code in the content area?

Question

Posted · Report post

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

Share this post


Link to post
Share on other sites

3 answers to this question

Posted · Report post

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/extend/plugins/shortcode-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.

Share this post


Link to post
Share on other sites

Posted · Report post

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: http://codex.wordpress.org/Writing_Code_in_Your_Posts

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites