[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 716
  • Last Modified:

insert page specific content into widget area in wordpress (for about 20 diferent pages)

I have about 20 pages (not posts) in my wordpress deployment I need to add some html (for a calendar) in the top sidebar that is specific for each page.   how can i do this?
0
bcoussens
Asked:
bcoussens
  • 3
  • 2
1 Solution
 
AndyBeardCommented:
Simple way would be a php widget and then use

if is_page('1') {
do something
} else if is_page('2'){

}

blah blah blah

or you could get more sophisticated and store stuff in arrays

A third option would be to use a widget, either php or one of many which are designed to output the contents of meta data.

Then on the posts concerned you could add some custom meta data for the calendar.
0
 
bcoussensAuthor Commented:
Ok i am not good with php, thought a widget might already exist but cant find one.  

I am trying your "if" code,

not sure how to specify the page?
 Url is: http://bookings.australianluxurystays.com.au/?page_id=269

would i use '269'

or 'page_id=269'
0
 
bcoussensAuthor Commented:
Have put the below code in a text widget,  I guess i need to start with something to let it know to read the php
if is_page('269') {
[booking nummonths=1 type=5 form_type='standard']
} else if is_page('270'){
hello page 270
}
else{

}

Open in new window

0
 
AndyBeardCommented:
You need to be using a text widget that supports php

you should just use the numbers

Here are some good samples on conditional tags
http://codex.wordpress.org/Conditional_Tags

But lets go for a plugin solution
This will allow you to display custom fields
http://wordpress.org/extend/plugins/get-custom-field-values/

Now we need a way to add an interface for adding the data to each page
http://wordpress.org/extend/plugins/custom-fields/

0
 
bcoussensAuthor Commented:
did not respond with any further confirmation
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now