How do I change the content in my sidebar using CSS? Not WordPress!

2 replies
  • WEB DESIGN
  • |
Hi,

I was wondering if this is possible.

Let's say I add a new article to my website. In my sidebar there's a section entitled RECENT POSTS:

Is there a way for me to add a link to the sidebar under "Recent Posts" to my new article without having to add the html link code to every page of my site?

Can I just add the link to my new article in the CSS code somehow and have it show up on each page?

I hope so.

Note: this is not a WordPress Site.

Thanks
#change #content #css #sidebar
  • Profile picture of the author osegoly
    There is definitely a way to do that but it doesn't involve CSS.

    Not sure what programming language you're using, I'll assume PHP. Components on your website which are to appear on more than a single page (e.g. header, footer, sidebars, etc.) shouldn't be programmed directly into each webpage. Instead, you want each one of those components to be coded into its own file, a master file.

    You then want to embed that master file into its appropriate spot on each webpage in which that component needs to appear.

    In PHP, you'd using the following code:

    <?php include "sidebar.php"; ?>

    So go through all your pages where the "Recent Posts" sidebar appears. Take out the HTML code and embed a master file instead. From now on, any time you want to modify the content of Recent Posts, you could open up the sidebar.php master file. The changes that you make within that file will then appear on every webpage in which your master file is embedded within.

    Good luck.
    {{ DiscussionBoard.errors[1810972].message }}
  • Profile picture of the author clickbump
    Originally Posted by aaallday2010 View Post

    Hi,

    I was wondering if this is possible.

    Let's say I add a new article to my website. In my sidebar there's a section entitled RECENT POSTS:

    Is there a way for me to add a link to the sidebar under "Recent Posts" to my new article without having to add the html link code to every page of my site?

    Can I just add the link to my new article in the CSS code somehow and have it show up on each page?

    I hope so.

    Note: this is not a WordPress Site.

    Thanks
    Can you tell us a bit more about how you are building your site? I understand what you are not using (WP) but I'm not sure enough about what you *are* using to be able to help you.
    Signature
    {{ DiscussionBoard.errors[1818100].message }}

Trending Topics