MaryE
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery] Can the tagcloud be in a sidebar widget?It’s been a while since I looked at this, and since then I’ve lost most of the changes. However, if you look at nggfunctions.php, you will see the tagcloud function — nggTagCloud().
This function has two returns in it — the first returns the gallery if a tag is specified in the querystring. If there is no tag in the querystring, then the second return produces the tagclould itself. So, instead of the returns, you can save these strings into an output and control how they are returned based upon the value in the tag.
I’d have to recreate the actual behavior I did last year, but as a start you can try the following to always produce the tagcloud regardless of the query sting (see comments for the changes):
function nggTagCloud($args ='', $template = '') { global $nggRewrite; // $_GET from wp_query $tag = get_query_var('gallerytag'); $pageid = get_query_var('pageid'); /** new output variable to store gallery **/ $out1 = ""; // look for gallerytag variable if ( $pageid == get_the_ID() || !is_home() ) { if (!empty( $tag )) { $slug = esc_attr( $tag ); /** change to a variable **/ $out1 = nggShowGalleryTags( $slug ); /** delete the return **/ /** return $out; **/ } } $defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'ngg_tag' ); $args = wp_parse_args( $args, $defaults ); $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags foreach ($tags as $key => $tag ) { $tags[ $key ]->link = $nggRewrite->get_permalink(array ('gallerytag' => $tag->slug)); $tags[ $key ]->id = $tag->term_id; } $out = '<div class="ngg-tagcloud">' . wp_generate_tag_cloud( $tags, $args ) . '</div>'; /** change to generate both tagcloud and gallery (if gallery exists **/ return $out . $out1; }
I think it would be better to copy this into some other file instead of changing base code, so this was intended as a start. If I get around to looking at this again this vacation, I’ll repost – the last piece is looking into parsing the shortcode and controlling the output of tagcloud and gallery ($out1 and $out).
What I’d really like to do is produce a widget that can generate a separate page based on a tag page template, but that’s a lot more work.
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery] Can the tagcloud be in a sidebar widget?Rughooking,
I got it to work with some code changes, provided both the tagcloud and its gallery are on the same page. Not sure that is what you are looking for. If you are, happy to share.
It involves a change to the nggfunctions.php file and a one line modification to the short codes (the version I had did not pass on the attributes from the shortcode).
With these changes, I can control the output of the shortcode:
[tagcloud show=cloud]
shows the tagcloud only
[tagcloud show=gallery]
shows the gallery onlyI changed the default to show both. Not fully tested.
Also added a title into the gallery to indicate which tag is being shown. So if the target page/post is the same for both the tag cloud and gallery, it’s ok. I’m having a few more challenges with targeting the output to another page from an attribute. Different file, different set of parameters …
M.
I think it’s the ‘Thumb’ definition in the compact section:
.ngg-album-compactbox .Thumb
You can adjust the width and height. That’s what I did to achieve square thumbs on my test site.
M.
I was taking the approach of just changing the plugin code and worrying about the change (delta) in the “next” release. It looks like you discovered the album tags, and they work with my 2.9 test install. I’ll throw in what I’ve discovered …
The file “nggfunctions.php” contains the shortcode functions (I think you already discovered this). It should be straight forward to force the tag cloud to always show — look at lines 1017 – 1023, that’s where the arguments of the url are queried. Note that on line 1023 there’s a return. You probably would want to move this conditional that to the bottom of the function (remove the return) and you’d have the result desired on the original request.
The sidebar is a little trickier, at this point, it may be worth just breaking up the functions and calling directly from the theme. A more elegant solution would be adding an argument to the shortcode (something like show=”album, cloud replace or both” with the default of replace.
The other issue of changing the target of the tag itself to point to another page can also be accomplished with a code. The easiest thing here is to have a default page as suggested above, modify the code (line 1015 of nggfunctions.php) to use it, and to place the ‘[tagcloud]` tag in the body of this page. This simple change could not coexist with having tags embedded in other pages or posts, unless an argument is added to the tagcloud shortcode, or the function is cloned and called directly (or another shortcode set up …)
One thing that cannot be done without a deeper code change (I think) is to place the tagcloud in a WordPress archive or search page. The permalink code assumes a page or a post. The permalink method is in the file rewrite.php in the ‘lib’ folder.
M.
Forum: Fixing WordPress
In reply to: 2 blogs 1 set of categoriesOne thing I didn’t consider is how to handle the query string – in other words, how to ensure that you are getting the intersection of two cats. There are a few ways to “brute force” this, but there may be a more elegant way with some apis.
Keep in mind that WP is a no-frills tool that can do all sorts of things – there’s a very rich set of user exits that can be exploited along with a theming engine. But the backend is very few DB tables and minimal code – which I find a blessing.
I’m selfishly interested in this problem as well – I’m looking at combining filters of dates, people, places, and things for an historical blog theme I’m putting together using timelines, historical maps, tagclouds, etc. There are 4-5 dimensions I want to filter on by using a combination of metadata to accomplish this. I find an intriguing relationship between pages, posts and their metadata that may be able to produce a theme to handle what I want, but it’s still in the experimentation phase. Oh yes, then there’s the page types – I’ve got historical posts, articles and artifacts to deal with!
M.
Forum: Fixing WordPress
In reply to: 2 blogs 1 set of categoriesBack to two blogs
Point both blogs to the same category table. OK, it is a one line change in a back-end file but it may not work with future upgrades! The trick is that the category table is defined independently of the posts table. If you do not know PHP well or expect to upgrade frequently I would discourage this. Also keep in mind that this must be done prior to any postings to a non-default category.
There may also be a way to build a plugin to synch up two different category tables. More work but probably safer.
M.
Forum: Fixing WordPress
In reply to: 2 blogs 1 set of categoriesThere are many ways to approach this in a single blog, here are a few ideas —
Idea #1.
Did you know that you can post to multiple categories? With that information, you could “facet” your categories.The trick here is to ensure that the categories are correctly entered. For simplicity, you can use some special character for the format type to the top (categories default in an alpha listing). Then your category “check box area” would look like:
__Article __Trivia Question Category 1 Category 2 ...
You can set your default category to “__Article”. You could do all this OOB. On the theme/template side, you can check for category membership. (It’s a little PHP) You may actally be able to use the theming engine templates for categories – you can style different categories based on template names.
But you’d still have to filter by the categories themselves. You will have to learn about templates/themes anyway even if you are going the two-blog route. Also, have you considered how to style the mixed set of postings as a search result, etc.? Another reason to look a themes.
Idea #2.
Another possibly more orthodox approach is to use a metadata tag but that would take some work to style.Idea #3.
Yet another possibility is to use pages for articles and postings for questions – but you’d be faking the categories on the pages by page hierarchy. And you’d be limited to two posting types.Back to two blogs.
I’ll take a look at how the DB tables are managed, it might not be too bad a hack on the back end – although I loathe back end hacks.M.
Forum: Fixing WordPress
In reply to: 2 blogs 1 set of categoriesI’m still not clear why you want two blogs. You may be able to achieve the same results with different authors to categories. You would need to change the themes to take into account the author, but that might work …
Way back in pre-1.5 days, you could configure the back end table by table (hence sharing the cat table), but now the DB layer’s been changed so there’s only one prefix extension for the entire set of DB tables. But since themes, I think there are easier ways of achieving the same results.
HTH, M.
Forum: Plugins
In reply to: Gripe against PHP dates prior to 1969Nice site. I don’t know the specifics of your problem, but I did notice more had to change in 2.03, and the permalinks needed extra attention. From my experience, the following files to be changed:
* functions.php
* functions-formatting.php
* template-functions-general.php
* template-functions-link.phpThe templating functions seem to be a new twist. I only include adodb_time.inc into functions.php, which are included in the other 3 files.
The permalinks require a 2 line change to replace strtodate() with code used in other functions elsewhere in WP.
More specifically, in file template-functions-links there is the following code around line 53:
$unixtime = strtotime($post->post_date);
$category = '';
if ( strstr($permalink, '%category%') ) {
$cats = get_the_category($post->ID);
$category = $cats[0]->category_nicename;
if ( $parent=$cats[0]->category_parent )
$category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
}
$authordata = get_userdata($post->post_author);
$author = $authordata->user_nicename;
$date = explode(" ",date('Y m d H i s', $unixtime));
Looking at the first and last line in this fragment — you will be changing these:
First line to change:
$unixtime = strtotime($post->post_date);
==> change this to the following 2 lines (or it can be 1 line if you don’t like the $m variable):
$m = $post->post_date;
$fulltime = adodb_mktime(substr($m,11,2), substr($m,14,2), substr($m,17,2),substr($m,5,2), substr($m,8,2), substr($m,0,4));
Second line to change:
$date = explode(" ",date('Y m d H i s', $unixtime));
==> change this to the following 1 line:
$date = explode(" ",adodb_date('Y m d H i s', $fulltime));
—————————————–
Don’t know if this solves your problem, but it was definitely a problem for me. Usual disclaimers, base code, back everything up, etc., etc. Also I did a quick eyeballing of the differences, if this and changes in the other 3 files don’t do the trick, I can do a diff on the codebase.
M.
Forum: Plugins
In reply to: Gripe against PHP dates prior to 1969Gee, I should read this forum more often (thanks for giving me bragging rights to my teenage kid). I’d love to see some examples in the wild, I’ve just been experimenting with reseach my husband’s been doing. Any urls for viewing?
Other things I’d like to do, let me know if there’s interest … candidates for WP plugins, perhaps?
- make a timeline along the design of blogtimes
- do something with circa dating – in general, be able to set granlarity of date entry and display
- deal with Julian vs. Gregorian dating – possibly tieing to country codes or geourl? – low priority but annoying ’cause I know it’s there as a “gap”.
While I’ve been using a variety of tools for my websites, I keep coming back to WP as a very simple but powerful tool to get the job done.
The latest version of another open source CMS has introduced an extension for adodb date libraries. But by the time I get everything set up just the way I want it (particularly getting the taxonomy modules in line with the date settings), I’ve gotten bored with the whole thing. So KUDOS to WP for keeping it simple!!
Forum: Alpha/Beta/RC
In reply to: Dates before 1970 Still broken in 2.0RC3?vkaryl,
I’ll give 2.05 a try tonight perhaps – these are just sites I dabble with – do not feel an “immediate” urge to update. Are you saying that I will not have to replace any date time functions? I still see “mktime()” being used in a number of functions … anyway a quick install will show if I can post dates on an entry prior to 1900.
M.
Forum: Alpha/Beta/RC
In reply to: Dates before 1970 Still broken in 2.0RC3?Klaa,
Sorry for the hiatus, here’s what I’ve found, based upon WP 2.03 (been playing w/ some other sw):
WP 2.x needs requires a bit more modification to support adodb date/time functions than previous versions of WP. In particular, I had to change the following files to get the funcitons to operation properly:
* functions.php
* functions-formatting.php
* template-functions-general.php
* template-functions-link.phpThe templating functions seem to be a new twist. I developed it under Windows (easyPHP) and have deployed it to Linux. I only include adodb_time.inc into functions.php. The permalinks require a 1 line change to replace strtodate() with code used in other functions elsewhere in WP.
Forum: Alpha/Beta/RC
In reply to: Dates before 1970 Still broken in 2.0RC3?2.x seems to want 4 different files changed, one of which requires a new line of code (for permalinks). This is unfortunate. If you want more details I can provide. Still testing it though.
M.
Forum: Plugins
In reply to: WP and photo gallery integration – any examples?Anyone uses the latest version of photostack? ? It’s one I’ve played around with, but no real experience.
MaryE
Forum: Plugins
In reply to: Gripe against PHP dates prior to 1969Glad someone else could use (test) this change. One area I have not fully investigated is whether the RSS feeds aggregate/order properly on these dates. That would be a nice way to tie together historical logs across multiple sites.
M.