Designing this site on WordPress and the client wants to be able to control the related information area in the sidebar. I have found plugins that use text to call from other places but none that allow him to just plug in and control whatever goes there. Does anyone know of anything that can help? Thanks
if text specific to post is required in the sidebar, I would use custom keys/values in the post and then use it in the sidebar.
Can you explain that more? See the related information section here on the right : http://illuminea.com/sandbox3/israel-experience/ He wants to be able to control and so far all the plugins ive found are coding and he cant control it (and like I said its obviously different for different pages)
hmm.. this asks for slightly more than just adding a piece of code in the sidebar.php. and i assume that you need this sidebar text only for pages with single posts. look at this piece of code - this has to be added to your single.php - scroll down to know where <?php /* ------------------------- sidebar post specific link hacks starts -------------------------------------------------- */ $your_custom_key = "sidebar-page-links"; $max_links = 5; $links_separator = "::"; $default_page_links = array( "http://illuminea.com/sandbox3/israel-experience/" . $links_separator . "Israel Connection", //"my-first-default-post-link.html" . $links_separator . "First Default Link Title", "http://illuminea.com/sandbox3/israel-experience/bar-bat-mitzvah-ceremoniesfamily-tours-to-israel/" . $links_separator . "Bar Bat Mitzvah Ceremonies/Family Tours To Israel", //"my-second-default-post-link.html" . $links_separator . "Second Default Link Title", "http://illuminea.com/sandbox3/israel-experience/concierge-services/" . $links_separator . "Concierge Services", //"my-third-default-post-link.html" . $links_separator . "Third Default Link Title", "http://illuminea.com/sandbox3/israel-experience/joel-abramson-musical-entertainment-in-israel/" . $links_separator . "Joel Abramson Musical Entertainment In Israel", //"my-fourth-default-post-link.html" . $links_separator . "Fourth Default Link Title", "http://illuminea.com/sandbox3/israel-experience/wedding-ceremonies-in-israel/" . $links_separator . "Wedding Ceremonies In Israel", //"my-fifth-default-post-link.html" . $links_separator . "Fifth Default Link Title" ); /* ------------------------- don't touch below if you dont know what your are upto ------------------------------------ */ global $sidebar_page_links; $sidebar_page_links = array(); if ( inarray( $your_custom_key, get_post_custom_keys() ) ) { $page_links = array_merge( get_post_custom_values( $your_custom_key ), $default_page_links ); } foreach ( $page_links as $ps ) { $ps_a = explode( $links_separator, $ps ); if ( $ps_a[0] = filter_var( $ps[0], "FILTER_VALIDATE_URL" ) ) $sidebar_page_links[$ps_a[0]] = $ps[1]; if ( count($sidebar_page_links) >= $max_links ) break; } /* ------------------------- sidebar post specific link hacks ends ---------------------------------------------------- */ ?> PHP: now go to your single.php and add the given piece of code into the loop - look at the code skeleton... you might just get it. <?php get_header(); // // // // if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- some html here --> <!-- this place is called inside the loop --> <!-- and you will have to add your code here --> <!-- just before endwhile --> <?php endwhile; ?> <?php else : ?> <!-- some more html here --> <?php endif; ?> PHP: next look at this piece of code, this has to be added to sidebar.php - scroll down to know where <?php global $sidebar_page_links; ?> <?php if (isset($sidebar_page_links) && $sidebar_page_links) : ?> <h2 class="title">Related info</h2> <ul> <?php foreach ($sidebar_page_links as $sps_link => $sps_text) : ?> <li><a href="<?php echo $sps_link; ?>" title="<?php echo $sps_text; ?>"><?php echo $sps_text; ?></a></li> <?php endforeach; ?> </ul> <?php endif; ?> PHP: go to your sidebar.php and if it is widgetized, add this code before the dynamic widget is defined - look at this code skeleton <div id="sidebar"> <!-- some html here --> <!-- and you will have to add your code here --> <!-- just before endwhile --> <?php if (!function_exists( "dynamic_sidebar" ) || !dynamic_sidebar()) : // or something like this saying dynamic_sidebar ?> <!-- some html migled with php code here --> <?php endif; ?> </div><!-- #sidebar --> PHP: next question: how to use it... in each of your post, insert a custom key named "sidebar-page-links" and value in the form of "http://my-domain.com/my-permalink.html::The Link Title" for each link that you want on the sidebar. remember: 1. the link href and link text are separated by '::' 2. there is a max 5 number of links that will be displayed. 3. your custom key is sidebar-page-links. the three of these options can be changed to your will at the top of this script to be added to single.php and last of all... this code is untested... so you might have to do some syntax error shooting by yourself... cheers r
Hey... I am trying to understand this, it is a little complex but I am working on it. My question is, will my client be able to adjust the comments from his wordpress backend?
sorry for such a late reply... 1. did the code work, for you? i assume that it did!!! 2. there are post specific comments and default comments. the default commnents are one time and are required to be handled from the theme editor. (well, you know well, that it is possible from wp backend) and post specific comments/links, are controlled using custom keys while writing the post. hope this helps.