Roger Theriault
Forum Replies Created
-
Forum: Plugins
In reply to: real estate listing plugins?? amaxaud, please send me an email through my website.
Forum: Your WordPress
In reply to: Examples of WP that don’t look like blogs?I moved my entire site over to WordPress about a month ago. My old site had custom built content management but I liked how I could now focus on making the site work better for me.
So here’s a Real Estate website built on WordPress to check out:
Forum: Plugins
In reply to: Looking for Video Gallery PluginWhat about WordTube?
Forum: Plugins
In reply to: Adding onto URL with custom Query?I’m game… have a beer… stay out of the htaccess file… keep your sanity… leave the wall alone…
First, you can go ahead and switch your permalinks to the pretty ones. Then you’ll get /PAGENAME/SUBPAGE/ and you’re half way there.
The key to the rest is the add_rewrite_endpoint function, it will do what you need (sort of… more like ?foo=bar… but you can take it from there). The code below is for PAGES, but you can change the second argument to turn it on for other items too.
Add something like this to your theme’s functions.php or your plugin:
// flush the rewrite rules function foobar_flush_rewrite_rules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } add_action('init', 'foobar_flush_rewrite_rules'); // add foo as a possible "tail" item add_rewrite_endpoint('foo',EP_PAGES); // add foo as an allowed query var function foobar_variables($public_query_vars) { $public_query_vars[] = 'foo'; return $public_query_vars; } add_filter('query_vars', 'foobar_variables'); // OPTIONAL - sample filter action if the query var is seen - // I'm using it to toss in an extra stylesheet that changes the page's // appearance function foobar_add_stylesheet() { // check for variants in link structure if (get_query_var('foo')) { // add stylesheet to hide certain divs echo "\n". '<style type="text/css" media="screen">@import "' . get_bloginfo('stylesheet_directory') . '/foo.css";</style>'."\n"; } } add_action('wp_head', 'foobar_add_stylesheet', 1);
You can also use the get_query_var() function on template pages to deal with your parameters.
I have no idea if this will work with more than one endpoint.
Forum: Plugins
In reply to: If (this page has subpages) then$post->ID works on my sub-pages, but shows nothing once in the sub-sub-page and $post->post_parent works on my sub-sub-pages, but shows an entire list of my pages on the sub-page. It’s very frustrating!
Remember ID and post_parent are parameters for the “child_of” attribute. ID = current post and therefore you’ll get all the children of the current post using ID. post_parent is the id of the current post’s parent, so you’ll get all of the parent’s children, which will include the current post and its “brothers and sisters”.
If you look at it in a family tree sort of way, infants can’t have children of their own, which is why you’re getting nothing on your sub-sub-pages.
Forum: Installing WordPress
In reply to: Fatal error in Dashboard, “Unsupported operand types” ?Thanks. I patched my 2.5.1 install. Would be nice if it eventually gets fixed for good, but thanks for the solution.
Forum: Plugins
In reply to: If (this page has subpages) then@kalikat – yes, replace $post->ID with $post->post_parent and you should generate a list of siblings (“brothers and sisters”) of the post you’re on.
See here for more attributes of the $post object: https://codex.www.ads-software.com/Function_Reference/get_post although template tags are preferred (if they exist) for easier upgrading.
Notice that on my site, I used some CSS styling to show the current section of my site in the right sidebar. I didn’t have to write code, just a bunch of CSS instead. I’m not sure how useful my site visitors find it but it’s an alternative (if you have 2.5 or up, since some of the styles are new).
@adamm – Try doing it with CSS, you can style a div that has an embedded div differently than one that does not.
Forum: Plugins
In reply to: Creating “callout” boxes within specific postsI assume you want something more or less automatic. If you don’t need automatic, just use a styled div when you need it.
Three possible approaches (and they can be developed together) would be to use a shortcode that gets replaced with a floating DIV box containing the looked up data, or to use a content filter that finds the first mention of a player’s name and inserts (nearby) the same thing, or to use a custom field that triggers the addition of the div inside the template logic.
This is actually fairly common on the magazine and newspaper sites.
Forum: Plugins
In reply to: real estate listing plugins?? aI’ve created a plugin and custom theme that display listings on their own pages. Not released to the public, more features on the way, but I’m using it myself and I can set it up for agents. It only requires WordPress (2.5).
Forum: Your WordPress
In reply to: Movie magazine site using WP as a CMSNice design! I like the summary lists with images on the right.
Some flakiness on your home page with FF2.0.0.14, the first few blogs items are laid over images labeled Review and Interview.
Forum: Plugins
In reply to: attachments associated with a post@ccwordpress – thanks for the typo tip – that’s what I get for cut and paste… now if I could remember where I cut/pasted from I could pass it on…
Of course, since my intent was to enumerate a bunch of mov files I had attached (which have no thumbs and aren’t images), I guess I should change the mime type.
Forum: Developing with WordPress
In reply to: custom field by defaultTry my code above, in your custom_add_save call xtend_updatemetafrompost($postID,’isBuilding’). You might want to start echoing here and there to debug, make sure your save_post action is getting run. Otherwise it generally looks correct. But you only need one or the other, add or update.
Did you look in the DB, or in the Custom Fields below your post form to see if there is a meta there after you check the box? If there is, the problem is on retrieval. – and make sure you are really passing a valid postID.
Also try tweaking your function names just in case there’s a conflict.
Forum: Requests and Feedback
In reply to: Stay on page when updating Custom FieldsHave you considered wrapping the fields up in a nice form chunk just below the post content, so you can edit all the fields at once and then submit it all at once?
I’m using several custom fields (or metas) as a way to sore real estate listing data associated with a page, and I just created a form with more descriptive labels and even drop-downs, etc. and captured all the $_POST[] data and stashed it in custom fields.
I think there’s even a plugin to manage that so you don’t have to code it.
https://www.ads-software.com/support/topic/145968Forum: Plugins
In reply to: Plugin: nextgen-gallery – Call tags for elements?Yes, but you’ll probably need to add some custom interface code to your theme’s functions.php or to your plugin file (or better yet an included file like interface-nggallery.php) and watch for upgrades that break your code… also, check for the gallery plugin being activated, etc…
I’m doing this on my own site, in my real estate listings I just associate a gallery id with the page/post via a custom meta element and a custom extra form on the pages edit page. Here is some of the interface code I use:
if (!class_exists('nggallery')) return; function get_re_gallerydropdown($currid = '') { global $wpdb; $tables = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY 'name' ASC "); if($tables) { foreach($tables as $table) { echo '<option value="'.$table->gid.'" '; if ($table->gid == $currid) echo "selected='selected' "; echo '>'.$table->name.'</option>'."\n\t"; } } } function xtend_nggallery_showfirstpic($galleryid = '') { global $wpdb; global $ngg_options; # if no id, look for the post's gallery id if (!$galleryid) { $galleryid = get_re_galleryid(); if (!$galleryid) return; } $picturelist = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '$galleryid' AND tt.exclude != 1 ORDER BY tt.$ngg_options[galSort] $ngg_options[galSortDir] LIMIT 1"); if ($picturelist) { $pid = $picturelist[0]->pid; $out = '<img src="' . nggallery::get_thumbnail_url($pid) . '">'; echo $out; } }
Just look in the php files of the plugin, you’ll find some functions you want are already there more or less, the rest you’ll have to create for your needs like the examples above.
Forum: Developing with WordPress
In reply to: custom field by default@ownersbox – Just create your own increment_counter function that gets the current value, converts to int, adds, and then calls update_post_meta (see above).
And I can’t take credit for the idea, Lester ‘GaMerZ’ Chan uses it in his WP-PostRatings plugin as a counter. It’s great for any data that is associated with a particular post that you usually have just one of, like number of views, ratings, or (for my real estate plugin) a listing’s price, number of bedrooms, etc.
See https://RogerTheriault.com/listings/ – I use a custom form to present and edit all the data that is displayed there including the map lat and long (and all the pointers to which gallery, panorama, video, etc to show on the detail page).
My plugin isn’t public and isn’t even fully tested yet. But here are a couple of utility functions I created:
function xtend_updatemeta($postID,$metakey,$single_or_list) { // permits storing or clearing out of meta from form input, // will work with multi-select inputs if (is_array($single_or_list)) { $commalist = implode(',',$single_or_list); // multiple } else { $commalist = $single_or_list; // one or blank } if (xtend_getmeta($metakey,$postID)) { update_post_meta($postID, $metakey, $commalist); } else { if ($commalist) // dont add if blank add_post_meta($postID, $metakey, $commalist); } } function xtend_updatemetafrompost($postID,$metakey) { // call this when you may have form data to stash away $postvalue = $_POST[$metakey]; xtend_updatemeta($postID,$metakey,$postvalue); } function xtend_getmeta($metakey,$postID = '') { // call this to grab the data global $post; if ($postID == '') $postID = $post->ID; return get_post_meta($postID, $metakey, true); }