Caused me some headache. I had to query posts inside a wordpress extension by their id and return an array of the corresponding post objects. At the moment this is the best solution I found for the problem, even if the code doesn't clearly state what I am doing:
query_posts(array('post__in' => $this->postids, 'post_type'=> ''));
$posts = array();
while (have_posts()) {
the_post();
$posts[] = get_post(get_the_ID());
}
wp_reset_query();
return $posts;
So first we query the posts by id. Then we start with the loop and use get_post() to get the post. get_post() sadly doesn't return the current post by default, so we have to pass it the id of the current post (this is so stupid). Once we pass the id it returns a post object which we store inside the $posts array which is returned at the end of the method.
Check http://codex.wordpress.org/Function_Reference/get_post, you might also return the posts as an numeric / associative array instead of an object if you like.
Mittwoch, 20. März 2013
Donnerstag, 20. Dezember 2012
Freitag, 9. November 2012
wildcard && brace expansion -eq <3
mplayer *s05e0{1,2,3}*
Queues the following files:
xyz.s05e01.someformat
abc.s05e02.someotherformat
123.s05e03.format
...
Check http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html
Queues the following files:
xyz.s05e01.someformat
abc.s05e02.someotherformat
123.s05e03.format
...
Check http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html
Montag, 22. Oktober 2012
undefined symbol: apr_reslist_maintain after upgrading httpd on Slackware 13.37
After upgrading apache to the latest patch (ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/) you get that error: "/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_reslist_maintain" when starting httpd / apache.
In order to resolve it you have to update apr (Apache Portable Runtime, makes sense, huh? ;)) and apr-util to the latest patched versions (get them here ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/).
In order to resolve it you have to update apr (Apache Portable Runtime, makes sense, huh? ;)) and apr-util to the latest patched versions (get them here ftp://ftp.slackware.com/pub/slackware/slackware-13.37/patches/packages/).
Donnerstag, 18. Oktober 2012
"QGtkStyle was unable to detect the current GTK+ theme." [SOLVED]
Finally found the solution:
gconftool-2 --set --type string /desktop/gnome/interface/gtk_theme your-theme-name
Source: https://bbs.archlinux.org/viewtopic.php?pid=1067521
Source: http://forums.opensuse.org/english/get-technical-help-here/network-internet/455664-errors.html
gconftool-2 --set --type string /desktop/gnome/interface/gtk_theme your-theme-name
Source: https://bbs.archlinux.org/viewtopic.php?pid=1067521
Source: http://forums.opensuse.org/english/get-technical-help-here/network-internet/455664-errors.html
Dienstag, 25. September 2012
Show single image with xlock
Took me a while to figure out how to simply show an image when locking with xlock:
$ xlock -mode image -bitmap image.xpm -count 1
-mode image: sets the mode to only display random sun images
-bitmap image.xpm: replace the random sun images with image.xpm (*)
-count 1: sets the amount of images that shall be shown at the screen at once to 1
* use ImageMagicks 'convert' method to convert to xpm: $ convert input.jpg output.xpm
Have fun!
$ xlock -mode image -bitmap image.xpm -count 1
-mode image: sets the mode to only display random sun images
-bitmap image.xpm: replace the random sun images with image.xpm (*)
-count 1: sets the amount of images that shall be shown at the screen at once to 1
* use ImageMagicks 'convert' method to convert to xpm: $ convert input.jpg output.xpm
Have fun!
Mittwoch, 4. Juli 2012
x121e Cardreader (rtl_pstor) - Kernel 3.4.4 menuconfig
Took me a while to figure out where the driver for my cardreader resides. In menuconfig go this path:
Device Drivers -> Staging drivers
and check this one, either as module or builtin:
RealTek PCI-E Card Reader support
Device Drivers -> Staging drivers
and check this one, either as module or builtin:
RealTek PCI-E Card Reader support
Labels:
3.4.4,
cardreader,
kernel,
Linux,
menuconfig,
rtl_pstor,
Slackware
Abonnieren
Posts (Atom)