Photoshop Contest Forum Index - Requests ONLY - Wordpress and php - two problems to fix - Reply to topic
Goto page 1, 2 Next
Michel
Location: Montreal, Canada
|
Mon May 24, 2010 8:24 pm Reply with quote
I am setting up a wp based web shop for a co-worker on my server. It is working pretty well so far, I am compensating my lack of php knowledge by adding plugins and quoting out the coding I don't need. There are only two issues I haven't been able to solve. I have asked on the wordpress.org forum, but didn't get any help so far. I will post them here, in case anyone can help me.
Multiples pages for RSS feed excerpts
edit: this problem got fixed!
I have a wp-based website for an online shop. The items are listed as posts, the navigation is based on categories. To display thumbnails of the items in the category pages, I have used the_excerpt_rss() in archive.php and put thumbnails in the excerpts field of each post. It works beautifully, but I also would like to limit the number of thumbnails appearing on the category pages and have a "next" link to other pages if more items exist for that category.
Is there some kind of plugin that exists for that purpose? I looked into NextGen Gallery, but there seems to be way too much steps involved for the user when adding a new post item. Did I go the wrong path by using RSS links instead of, say attaching thumbnails to individual posts and having those appear in the archive.php page?
wp_list_categories, displaying children links only
edit: this problem got fixed!
I have a wp-based website for an online shop. The items are listed as posts, the navigation is based on categories. For parent category pages (archive.php), I want to have the children categories listed as links. I don't want to code every parent page individually (child_of=x). I've found the following code, but there seems to be an error somewhere, as not only the children categories are listed, but all of the website's categories.
<?php
$children = wp_list_categories('title_li=&child_of='.$category->cat_ID.'&echo=0');
if ($children) { ?>
<?php echo $children; ?>
<?php } ?>
The website can be found here.
|
Procyon
Site Admin
Location: Toronto, ON
|
Tue May 25, 2010 1:05 pm Reply with quote
any luck with this?
_________________ Feel free to PM me, but PM a mod if you think they can help you. If you've won a prize, contact me!
|
TofuTheGreat
Location: Back where I belong.
|
Tue May 25, 2010 2:14 pm Reply with quote
Michel wrote: ...To display thumbnails of the items in the category pages, I have used the_excerpt_rss() in archive.php and put thumbnails in the excerpts field of each post. It works beautifully, but I also would like to limit the number of thumbnails appearing on the category pages and have a "next" link to other pages if more items exist for that category.
Is there some kind of plugin that exists for that purpose?
You could try linking in to jQuery and using the ColorBox plugin. Then what you'd do is hide every thumbnail but the first. The ColorBox plugin allows you to group the images for an elegant slideshow interface.
Code: <link rel="stylesheet" href="/css/colorbox.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script language="JavaScript" src="/js/jquery.colorbox-min.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
$(function(){
$("a[rel='thumbnail']").hide().colorbox(); //activates the image viewer on all images with the rel="thumbnail" attribute
$("a[rel='thumbnail']:first).show;
})
/*]]>*/
</script>
Haven't tested that but it might work.
For the second question are your categories in a database table? If so then it appears that you want a simple recursion function to build the list of categories. I've done this with ASP/VBScript but not with PHP. I'm sure Trey, Tony or Supa could provide some syntax help there?
_________________ Why I do believe it's pants-less o'clock! - Lar deSouza
”The mind is like a parachute, it doesn’t work if it isn’t open.” - Frank Zappa
Created using photoshop and absolutely no talent. - reyrey
|
TofuTheGreat
Location: Back where I belong.
|
Tue May 25, 2010 2:32 pm Reply with quote
For my solution to part II you'd need the following categories table structure:
Code:
CatID P_CatID Description
----- ------- --------------------------
1 0 Parent Level 1
2 0 Parent Level 2
3 1 Child1 to Parent Level 1
4 1 Child2 to Parent Level 1
5 2 Child1 to Parent Level 2
Then we have the recursion routine loop through that table (semi-psuedocode here):
Code:
function DoList(Passed_CatID)
sqlCommand = "SELECT * FROM Categories WHERE P_CatID = [Passed_CatID]"
categories = execute(sqlCommand)
echo("<ul>")
do while not categories end
echo("<li>"+categories(Description)+"</li>"
DoList(categories(CatID))
loop
echo("</ul>")
end function
DoList(0)
Again the above is NOT language-specific syntax for any language I've seen. However it should be translatable into PHP by someone who knows PHP. The output should be:
Code: <ul>
<li>Parent Level 1
<ul>
<li>Child1 to Parent Level 1</li>
<li>Child2 to Parent Level 1</li>
</ul>
</li>
<li>Parent Level 2
<ul>
<li>Child1 to Parent Level 2</li>
</ul>
</li>
</ul>
_________________ Why I do believe it's pants-less o'clock! - Lar deSouza
”The mind is like a parachute, it doesn’t work if it isn’t open.” - Frank Zappa
Created using photoshop and absolutely no talent. - reyrey
|
TofuTheGreat
Location: Back where I belong.
|
Tue May 25, 2010 2:38 pm Reply with quote
Also, after looking a bit closer, your current code is putting the entire description into the title attribute of the link. This could be affecting the rendering of the list as the descriptions could have quotes that prematurely end the title attribute.
Sample from your site:
Code: <h1>Vêtements</h1>
<ul>
<li class="cat-item cat-item-3"><a href="http://blueheronvisions.com/recup-o-jouets/category/apprentissages/" title="">Apprentissages</a>
<ul class="children">
<li class="cat-item cat-item-85"><a href="http://blueheronvisions.com/recup-o-jouets/category/apprentissages/developpement/" title=".
.
DÉVELOPPEMENT PERCEPTIVO-COGNITIF
Perceptivo: Tout ce qui appelle à la perception. Reconnaître un objet parmi plusieurs, lequel est pareil, pas pareil.
Exemple de jouets: Casse-tête, bloc Légo (relation pièce dans espace spatial)
Cognitif: Développement de l’intelligence. Tout ce qui fait appel au cerveau,
la mémoire, l’attention, la planification d’une tâche, la concentration et la logique.
Bébé: Touche quelque chose apporte un son, principe ACTION-RÉACTION.
Casse-tête:tel morceau va à tel place dû à sa forme.
-
-
-
-
MOTRICITÉ GLOBALE
Activités motrices sollicitant plusieurs ou l'ensemble des parties du corps qui nécessitent l'intervention et la coordination de groupes musculaires importants.
Ex: marche, course, saut, natation, lancer, etc...
-
-
-
-
MOTRICITÉ FINE
La motricité fine vise à développer les mouvements fins qui permettent un meilleur contrôle et une meilleure coordination des doigts, des mains, des yeux, etc. Elle tend à renforcer les membres supérieurs.
Par définition, la motricité fine est ce qui permet de manier des objets, les ramasser, les manipuler et les lâcher en utilisant la main, les doigts et le pouce, comme ramasser des pièces de monnaie sur une table, tourner un cadran de téléphone ou un bouton.
Le développement de la motricité fine fera travailler l'enfant de façon à ce qu'il apprenne à se servir de ses doigts plutôt que la main complète.
Ex: Le bambin très jeune prendra les objets avec ses mains comme une pince(mouvement quadridigitale).
Exemple de jouet: Boulier, collier, bricolage, un hochet, etc...
-
-
-
-
DÉVELOPPEMENT SENSORIEL
C'est l'évolution des acquisitions sensorielles et motrices d'un individu. Soit l'audition, l'olfaction(odeur), goût, vision et le toucher.
Exemple de jouet de bébé:
Tapis d'éveil, mobile de lit, jouet musical
-
-
-
-
JEUX D'IMITATION
Les jeux d'imitation sont des jeux/jouets qui permettent aux enfants de faire comme les grands. Ils permettent d'imiter maman, papa, le mécanicien, la coiffeuse, etc...
C'est entre 2 et 6 ans que le besoin pour l'enfant de jouer à ce type de jeux ce manifeste. Il permet à l'enfant de comprendre le fonctionnement du monde qui l'entoure, de comprendre les relations entre les individus ainsi que les rôles sociaux.
Exemple de jouet d'imitation:
Établie, cuisine, costume de déguisement et même une boîte de carton qu'on peut transformer en château pour la princesse !
">Développement de l'enfant</a>
</li>
_________________ Why I do believe it's pants-less o'clock! - Lar deSouza
”The mind is like a parachute, it doesn’t work if it isn’t open.” - Frank Zappa
Created using photoshop and absolutely no talent. - reyrey
|
Michel
Location: Montreal, Canada
|
Tue May 25, 2010 5:05 pm Reply with quote
TofuTheGreat wrote: Michel wrote: ...To display thumbnails of the items in the category pages, I have used the_excerpt_rss() in archive.php and put thumbnails in the excerpts field of each post. It works beautifully, but I also would like to limit the number of thumbnails appearing on the category pages and have a "next" link to other pages if more items exist for that category.
Is there some kind of plugin that exists for that purpose?
You could try linking in to jQuery and using the ColorBox plugin. Then what you'd do is hide every thumbnail but the first. The ColorBox plugin allows you to group the images for an elegant slideshow interface.
From what I have seen, ColorBox is alike thickbox, which I already use on the page ( and I LOVE it! ). I was thinking of something like what is found here. The same way the results are displayed on the page, I would have a limited amount of thumbnails displayed on my page and the rest could be accessed with a 'next' button.
TofuTheGreat wrote: For the second question are your categories in a database table? If so then it appears that you want a simple recursion function to build the list of categories. I've done this with ASP/VBScript but not with PHP. I'm sure Trey, Tony or Supa could provide some syntax help there?
The data is put in a mysql database by wp, the categories are already classified in a family tree. The wp_list_categories wp template tag displays a list of categories as links, the child_of argument makes it so that only the child of a certain category are displayed. They expect me to put child_of='ID number of the category', but I want it to display the childs of the CURRENT category page being displayed. wp doesn't seem to pickup on my '.$category->cat_ID.'&echo=0' integer, so it displays everything.
|
TofuTheGreat
Location: Back where I belong.
|
Tue May 25, 2010 5:51 pm Reply with quote
Michel wrote: From what I have seen, ColorBox is alike thickbox, which I already use on the page ( and I LOVE it! ). I was thinking of something like what is found here. The same way the results are displayed on the page, I would have a limited amount of thumbnails displayed on my page and the rest could be accessed with a 'next' button.
Yep ColorBox is quite a bit like ThickBox (and facebox). I've used Facebox in the past but I prefer the functionality and control I have with ColorBox. Haven't played with ThickBox personally so I can't compare. All three are jQuery plugins though so you're good to go no matter which one you use. Just the integration will be different. I did notice that WP says:
Quote: For the native wordpress galleries the plugin inserts the "thickbox" class name and rel properties automatically. So maybe you should stay with thickbox? I've never used WordPress myself so I don't know how to activate the plugins in the interface.
I'll have to look up the WP database structures to give any further help on the category issues. Won't really have time to do that until later in the week at the earliest. Hopefully Trey/Tony/Supa will decide to chime in soon.
_________________ Why I do believe it's pants-less o'clock! - Lar deSouza
”The mind is like a parachute, it doesn’t work if it isn’t open.” - Frank Zappa
Created using photoshop and absolutely no talent. - reyrey
|
Michel
Location: Montreal, Canada
|
Tue May 25, 2010 6:15 pm Reply with quote
TofuTheGreat wrote: Michel wrote: From what I have seen, ColorBox is alike thickbox, which I already use on the page ( and I LOVE it! ). I was thinking of something like what is found here. The same way the results are displayed on the page, I would have a limited amount of thumbnails displayed on my page and the rest could be accessed with a 'next' button.
Yep ColorBox is quite a bit like ThickBox (and facebox). I've used Facebox in the past but I prefer the functionality and control I have with ColorBox. Haven't played with ThickBox personally so I can't compare. All three are jQuery plugins though so you're good to go no matter which one you use. Just the integration will be different. I did notice that WP says:
Quote: For the native wordpress galleries the plugin inserts the "thickbox" class name and rel properties automatically. So maybe you should stay with thickbox? I've never used WordPress myself so I don't know how to activate the plugins in the interface.
I'll have to look up the WP database structures to give any further help on the category issues. Won't really have time to do that until later in the week at the earliest. Hopefully Trey/Tony/Supa will decide to chime in soon.
Tofu, I thank you for your help, for some reason it made me hopeful that I might even find a solution myself for the problem regarding the multiple pages.
Here's my ideas: I know there's already bits of codes that generates multiple pages in wp, the search box is one example; I will take a look at that code and try to adapt it to my needs. I'll be less hopeful once I've been working on it for 5 hours if nothing comes out of it.
|
Michel
Location: Montreal, Canada
|
Tue May 25, 2010 7:21 pm Reply with quote
Problem number one is resolved. I had deleted much of the stuff I thought I wouldn't need in the coding. The search box code was written to archive.php and I had deleted it. I just added a plugin called WP-PageNavi and called the function with <?php wp_pagenavi(); ?> and it worked like magic!
In wp, there's a setting about how many links you want displayed on a page, if the amount of links on a certain category page is greater than the number of link/page setting, TA-DA the page navigation appears.
I might try to put the old navigation code back in, because I don't like putting too many plugins. Shame on me for deleting all that code!
|
Michel
Location: Montreal, Canada
|
Tue May 25, 2010 8:17 pm Reply with quote
Solved! The right syntax was :
<?php
$children = wp_list_categories('title_li=&child_of='.$cat.'&echo=0');
if ($children) { ?>
<?php echo $children; ?>
<?php } ?>
I'm sorry, but code is not poetry, code is a pain in the butt!
Thanks Tofu, you've helped me more than you'd know, I was feeling like I was going nowhere with this thing.
|
marcoballistic
Location: I am everywhere, and Nowhere, but mostly, I am right here!
|
Tue May 25, 2010 8:20 pm Reply with quote
wow, so many letter and numbers and pointy arrow things
you lost me at..... (scrolls up for first word)....
I
|
Michel
Location: Montreal, Canada
|
Tue May 25, 2010 8:29 pm Reply with quote
marcoballistic wrote: wow, so many letter and numbers and pointy arrow things
you lost me at..... (scrolls up for first word)....
I
Yeah, I know, but now my co-worker can start his small home business. And I make a few $$$
|
marcoballistic
Location: I am everywhere, and Nowhere, but mostly, I am right here!
|
Wed May 26, 2010 1:03 am Reply with quote
well just sorry couldn't help, looks like you got a few people in the know
Good luck with it all
|
TofuTheGreat
Location: Back where I belong.
|
Wed May 26, 2010 9:29 am Reply with quote
Michel wrote: Solved! The right syntax was :
<?php
$children = wp_list_categories('title_li=&child_of='.$cat.'&echo=0');
if ($children) { ?>
<?php echo $children; ?>
<?php } ?>
I'm sorry, but code is not poetry, code is a pain in the butt!
Thanks Tofu, you've helped me more than you'd know, I was feeling like I was going nowhere with this thing. Excellent! I'm glad you were able to solve it! Especially on your own! Makes ya feel good don't it? Whenever I solve a vexing programming issue I do "the programmer happy dance".
Plus I learned a couple things about PHP and WordPress that I didn't know before. Win-Win!
_________________ Why I do believe it's pants-less o'clock! - Lar deSouza
”The mind is like a parachute, it doesn’t work if it isn’t open.” - Frank Zappa
Created using photoshop and absolutely no talent. - reyrey
|
Michel
Location: Montreal, Canada
|
Wed May 26, 2010 9:33 am Reply with quote
TofuTheGreat wrote: Whenever I solve a vexing programming issue I do "the programmer happy dance".
I'll have to Google that one, I'm sure there's a video out there about that...
|
Goto page 1, 2 Next
Photoshop Contest Forum Index - Requests ONLY - Wordpress and php - two problems to fix - Reply to topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|