supergab
Forum Replies Created
-
Forum: Plugins
In reply to: Looking for a plugin that will delete unused images in uploads folderI’ve tried both plugins but they show used files as unused files and I don’t feel safe about it.
Forum: Themes and Templates
In reply to: Removing and adding class to category linksYes sure… https://themes.visualise.ca/visualise/
There are two category menus in the left sidebar. The first (top) is hand coded:
[Code moderated as per the Forum Rules. Please use the pastebin]
I need the second one to have the li classes of the first.
Forum: Themes and Templates
In reply to: How can I get the post ID from a post slug?OK it was also missing the s at posts and now it works … THANK YOU so much ! ??
<?php $my_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$slug'"); ?>
Forum: Themes and Templates
In reply to: How can I get the post ID from a post slug?Is there a syntax error in your code?
Forum: Themes and Templates
In reply to: How can I get the post ID from a post slug?It says page slug … I need post slug … Do you think it’s still good ?
Here is what I tried, in functions.php:
<?php function get_ID_by_slug($page_slug) { $page = get_page_by_path($page_slug); if ($page) { return $page->ID; } else { return null; } } ?>
and
<?php function get_ID_by_slug($post_slug) { $post = get_post_by_path($post_slug); if ($post) { return $post->ID; } else { return null; } } ?>
In my wordpress php template page where I need to get the ID of a post which has ‘josie’ as page name (slug).
<?php $my_id = get_ID_by_slug('josie'); ?>
Doesn’t work. :-/
Thank you very much!
By reading my question again I realized that I’ve asked more than I needed.
Your function replaces cat-item-* but all I really needed is to add the category class. But thanks it’s even better! ??
Thank you
I get syntax error
<?php function my_attachment_image($postid=0, $size='full', $attributes='') { if ($postid<1) $postid = get_the_ID(); if ($images = get_children(array( 'post_parent' => $postid, 'post_type' => 'attachment', 'numberposts' => -1, 'orderby' => 'menu_order', 'exclude' => '1', 'post_mime_type' => 'image',))) $to_exclude = 1; $i = 1; foreach($images as $image) { $attachment=wp_get_attachment_image_src($image->ID, $size); if( $i != $to_exclude ){ ?><a href="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> rel="fancybox-<?php echo $postid; ?>"> </a><?php } $i++ }?>
Could you guide me please ?
Thanks… I ended up opening another thread. ??
Thanks ! ??
OK I was not clear enough, sorry about that.
the_post_thumbnail outputs:
<img src="https://link.to/img-thumbnail.jpg" />
I would like it to output:
<a href="https://link.to/img-large.jpg"><img src="https://link.to/img-thumbnail.jpg" /></a>
or simply:
https://link.to/img-large.jpg
if possible?
Forum: Plugins
In reply to: [Plugin: AsideShop] Not compatible with WP 2.8?Still the same problem with 2.8.2.
Please solve this issue!
Forum: Plugins
In reply to: WPG2 & ShadowboxWhere exactly do you add this line ?
Many thanks.
Forum: Fixing WordPress
In reply to: Would like to try an alternate loop suggestion please.OK I modified the CSS and it’s all good now. Thanks.
Forum: Plugins
In reply to: [Plugin: AsideShop] Works in testing mode (when logged in), not when enabledOK I’ve found the cause, my WordPress loops.
I use a loop in the index.php to display my posts and another in the sidebar.php in order to show the last post of one category.
Here is the sidebar.php loop which is called before the index.php:
<?php $my_query = new WP_Query('category_name=pensees&showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;?> <div id="post-<?php the_ID(); ?>"> <h3 class="sidetitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <div class="penseecontent"> <?php the_content(__('(more...)')); ?> </div> </div> <?php endwhile; ?>
Here is the index.php loop:
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <?php if (in_category('7') && is_home() ) continue; ?> <div class="post" id="post-<?php the_ID(); ?>"><div class="post-other"><div class="post-ie"> <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <div class="storycontent"> <?php the_content(__('(more...)')); ?> </div> <?php comments_template(); // Get wp-comments.php template ?> </div></div></div> <?php endwhile; else: ?> <?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?>
If I call the sidebar.php after the plugin works fine. But my design is messed up.
By the way this causes this other problem too.