vestaviascott
Forum Replies Created
-
Forum: Hacks
In reply to: How to add conditional sidebarsI’m following this too.
Forum: Plugins
In reply to: Must call $wp_rewrite after update_options(‘permalink_structure’) ???wp_rewrite does not appear to have any effect. Users still have to manually click “Save Options” on the permalinks screen.
I suppose I will run firebug on that page during the update to see what’s getting set that update_options is apparently missing.
This would appear to be a bug in update_options when the option being updated is permalink_structure.
Anyone disagree?
Forum: Plugins
In reply to: Media Manager > Overwrite media without appending a “1” to itAnyone? I’m dying for a solution to this ??
Forum: Plugins
In reply to: List 10 most recent posts, then a “View All Posts” link. Code helpMichael, you continue to amaze me. Huge Props!
~ s
Forum: Plugins
In reply to: How can I insert a category with script? If it does not already exist…Sweet, thanks stvwlf
Only problem I have is that I’m trying to do this update from my theme’s functions file via a hyperlink to a file I’ve created that contains the function. However, the function is undefined in my file since I don’t know which files to include that define the function. Perhaps there is another way to do it.
I just want to provide a link in my custom theme’s function file that says “click here to create the category” and this would call a function that would execute the wp_create_category function.
Forum: Plugins
In reply to: Media Manager > Overwrite media without appending a “1” to itIf the above option is not possible, then I’d look for suggestions on how to do a workaround by doing the following…
since the image will named be something like…
blue-yoga-mat-11.jpg
OR
blue-yoga-mat-21.jpg
And I’m expecting an image like
blue-yoga-mat-1.jpg
OR
blue-yoga-mat-2.jpg
Is their a way I could use regex or string manipulation to just find a match on the pattern blue-yoga-mat-1 ?
Example, I’m preloading four images, and I’m expecting them to be blue-yoga-mat-1.jpg, blue-yoga-mat-2.jpg, blue-yoga-mat-3.jpg, blue-yoga-mat-4.jpg
But the way WP works, these files might actually be named blue-yoga-mat-11.jpg, blue-yoga-mat-21.jpg, etc
My img tag looks like this…
<img src=”blue-yoga-mat-1.jpg” />
But if that’s not available, I’d just like it to load any image that matches the pattern blue-yoga-mat-1, so it could dynamically search and discover that the closest match is blue-yoga-mat-11.jpg and make the img tag…
<img src=”blue-yoga-mat-12.jpg” />
Clear as mud?
Forum: Plugins
In reply to: List all posts not in a named categoryThis did it….
<ul><h3>Recent Posts</h3> <?php global $post; $cat=get_cat_ID('top-menu'); $myposts2=get_posts(array('post__not_in'=>get_option('sticky_posts'),'cat'=>-$cat)); foreach($myposts2 as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
Forum: Plugins
In reply to: List all posts not in a named categoryALMOST THERE!!! I got it all sorted out, but now I need to exclude all sticky posts…
<ul><h3>Recent Posts</h3> <?php global $post; $cat=get_cat_ID('top-menu'); $myposts2 = get_posts('cat='.-$cat); foreach($myposts2 as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
Forum: Plugins
In reply to: List all posts not in a named categoryI’ve got $cat and $post declared in the header as well, will these conflict with one another? Particularly since $post is global in scope?
Forum: Plugins
In reply to: List all posts not in a named categoryMichael, thanks again for your help. I’ve streamlined the code a bit but for some reason, I’m getting a single post listed that is in the exclude category…
(the exclude category is named “top-menu” and the slug is also named top-menu, which is being referenced with get_cat_ID?)<ul><h3>Recent Posts(not in the top-menu category</h3> <?php global $post; $cat=get_cat_ID('top-menu'); $myposts2 = get_posts('category!='.$cat); foreach($myposts2 as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
Forum: Plugins
In reply to: List all posts not in a named categoryAwesomely fast response Michael! Now I know why you are the moderator. Thanks.
Just one more thing, I want the exclusion category to be dynamically scripted to match the lowercase of the blog title with “-” replacing the spaces. So if the Blog title is “My Blue Widget”, I want the exclusion category to be “my-blue-widget”…
Also, I’m using a list item structure, but no biggie…here’s my code…Would you do anything differently?
<div class="xmenu side"><span>Recent Posts</span> <ul> <?php $mycat = strtolower(get_bloginfo()); $mycat2 = str_replace (" ", "-", $mycat); $cat=get_cat_ID($mycat2); $args=array('category__not_in' => array($cat),'showposts'=>-1,'caller_get_posts'=>1); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; } ?> </ul> </div>
Forum: Plugins
In reply to: Where is the permalinks setting stored in the db?In the end it was so simple, I’m almost embarrassed to post the solution…
<?php update_option( $option_name, $newvalue ); ?>
Forum: Plugins
In reply to: Where is the permalinks setting stored in the db?Perfect, thanks Michael, now what I need to do is to create a script that will reside in my theme’s functions.php file that executes on a button click and updates the db as follows…
update wp_options set uploads_use_yearmonth_folders = 0;
update wp_options set permalink_structure = ‘/%postname%/’;Can you help me with the script?
In classic asp, I would use something like this…
sql = update wp_options set uploads_use_yearmonth_folders = 0
sql2 = update wp_options set permalink_structure = ‘/%postname%/’
set rs = conn.execute(sql)
set rs2 = conn.execute(sql2)
rs.close
rs2.closewhere “conn” is the open db connection
What is the PHP equivalent?
Forum: Plugins
In reply to: What are the top stats apps for wordpress? Need to replace Google AnalyticsIts lonely in here all alone ??
Anyone?
Forum: Themes and Templates
In reply to: Custom theme control panel with SELECT list, how?And here is my HTML code (just the section for the select)…
<?php break; case 'select': ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><select style="width:240px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?> <option id="-blue">Blue</option> <option id="-red">Red</option> <option id="-gold">Gold</option> <option id="fall">Fall</option> <option id="-girly">Girly</option> <option id="-grey">Grey</option> </select></td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr><tr><td colspan="2"> </td></tr>