Posts: 20
Threads: 3
Joined: Jun 2010
2011-08-19, 03:55:11
(This post was last modified: 2011-08-19, 04:02:10 by WroughtKadin.)
I want to display different information in sidebar of my site on every page.
And i don't want to make different templates for every page.
My idea is to input the construction like
Code:
<?php get_component('name of page slug'); ?>
I try to do this by this code:
Code:
<?php get_component('get_page_slug'); ?>
But it doesn't work.
Gentlemen's, give me advice please )
Posts: 2,094
Threads: 54
Joined: Jan 2011
kirilldmt Wrote:i want to display different information in sidebar of my site on every page.
and i don't want to make different templates for every page.
my idea is to input the construction like Code:
<?php get_component('name of page slug'); ?>
i try to do this by this code: Code:
<?php get_component('get_page_slug'); ?>
but it doesn't work.
Gentlemen's, give me advice please )
This would give you the component named
get_page_slug.
You need to call the function
get_page_slug, so use
Code:
<?php get_component(get_page_slug()); ?>
to output the component with the same name as your page.
Posts: 20
Threads: 3
Joined: Jun 2010
mvlcek Wrote:Code:
<?php get_component(get_page_slug()); ?>
it didn't help
Posts: 20
Threads: 3
Joined: Jun 2010
i do so, but it displayed only the name of slug. the component with same name didnt appeared
Posts: 2,094
Threads: 54
Joined: Jan 2011
mvlcek Wrote:You need to call the function get_page_slug, so use
Code:
<?php get_component(get_page_slug()); ?>
to output the component with the same name as your page.
My error. It's
Code:
<?php get_component(return_page_slug()); ?>
Posts: 20
Threads: 3
Joined: Jun 2010
Quote:mvlcek
this not helped too... i also thought about it.
Posts: 661
Threads: 52
Joined: Feb 2011
you could use the custom fields plugin to create anew text Area in Edit page culled "sidebar".
Then in your template, include that custom field in the sidebar
Posts: 2,094
Threads: 54
Joined: Jan 2011
kirilldmt Wrote:this not helped too... i also thought about it.
This works:
Code:
<?php get_component((string) return_page_slug()); ?>
Posts: 20
Threads: 3
Joined: Jun 2010
Oh! Thank u! It's really works! ))