Tag Info

Hot answers tagged

2

When you just have raw image files, that you want to assign to a post, wp_insert_attachment will do the job. With attachments already present in your database you can use wp_update_post to set the attachment's post_parent. Like this: wp_update_post( array( 'ID' => $attachment_id, 'post_parent' => $parent_post_id, )); To recieve a post's ...


2

Edit If this is your goal: I want to use the Wordpress gallery to show all pictures of one category in a gallery (on a fixed page), which I do not have to update all the time by inserting the pictures manually. Then the easiest way to accomplish it is via custom page template. Create the template Copy your page.php template file, and name it ...


1

Core shortcode Regular Expressions Basically we can do that with a Regex - actually even with the Regex provided by core by get_shortcode_regex(). First we need to grab the shortcode tags and build a regex. The core function get_shortcode_regex() sadly offers no chance to throw in an argument so we'd be left with a regex that matches each and every ...


1

remove_shortcode( 'gallery' ); add_shortcode( 'gallery', function( $atts ) { $atts = shortcode_atts( array( 'ids' => '' ), $atts ); return do_shortcode( "[wp-slideshow include=\"$atts[ids]\"]" ); } ); This may be better than replacing the gallery shortcode as if you decide to change plugin you will have the standard gallery shortcode which many ...


1

@MagentaCuda's solution is the simple solution and should function adequately. However, it does run the rather complicated shortcode regex twice, plus the additional processing of the do_shortcode() call. Both should be avoidable. You don't name the plugin you are using and a search reveals many possibilities that I don't have the time to dig through, so ...


1

In order of perferance: Option A : Use the plugin that you mention because the footer can have it's own custom sidebar, this makes it easy to manage. If you don't like that plugin it still makes sense to use a custom sidebar for your footer, there nothing stopping you from writing your own widget or shortcode. Option B : Create a CPT (or page), attach ...


1

I use this code to display information posts in widgets in my theme. This can easily be adapted to what you want to do. I just want to give credit to digitalraindrops, as this code was adapted from their twenty eleven business theme First, you need to register a sidebar and the widget you will add later. function pietergoosen_widgets_init() { ...


1

You can use the the following attributes for the gallery shortcode: [gallery itemtag="ul" icontag="li" captiontag="li"] The problem with this is that the gallery shortcode wraps the image and the caption in different elements(thats why the default solution is using dl-dt-dd), so this will generate one li element for the image, and one for the caption. You ...



Only top voted, non community-wiki answers of a minimum length are eligible