question
stringlengths
0
34.8k
answer
stringlengths
0
28.3k
title
stringlengths
7
150
forum_tag
stringclasses
12 values
I'm trying to add this social-network button: <code> &lt;a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" data-type="compact" id="svejo-button"&gt;Add in Svejo&lt;/a&gt; &lt;script type="text/javascript" src="http://svejo.net/javascripts/svejo-button.js"&gt;&lt;/script&gt; </code> to my blog posts...
You need to be hooking the function that calls the enqueue, personally I actually like to register scripts and enqueue them separately, rather than just enqueueing them, as it allows the flexibilty to enqueue conditionally and can save keystrokes down the line at little to no performance penalty. The code you are going...
wordpress wp_enqueue_script() not working
wordpress
In a multisite installation, I have a loop set up on my main blog that displays all posts from sub blogs, along with a thumbnail image. The image is important and without one will break the grid. Is there a way to reject posts that do not have a featured image? Thanks.
Try to use the has_post_thumbnail function. From the codex: <code> &lt;?php //This must be in one loop if(has_post_thumbnail()) { the_post_thumbnail(); } else { echo '&lt;img src="'.get_bloginfo("template_url").'/images/img-default.png" /&gt;'; } ?&gt; </code>
In a loop, do not display content that does not have a thumbnail
wordpress
I'm working on a conditional statement (in a loop) that looks for a featured image then grabs a default image if there is none, which I have figured out. But, I also wanted a way to pull the first image (or any image) attachment before going the route of the default image. Having trouble finding the right way to check ...
I'm using this code below, it's quite a bit, but it basically loops through post thumbnail, attached image, image in content and then to an image per category (which is a fixed set on my site, hence the naming scheme of the images in <code> get_post_category_image </code> . The main usage is through the last function, ...
Conditional Statement - check if post has an attachment image
wordpress
This might sound like query_posts with pagination problem number 2103024 but I think this one might be special. My WordPress site is basically a huge database of car images. Each image should have tags like 'color' => 'red' but a set of images should be grouped in a gallery with certain other tags like 'location' => 'M...
Allright, here's how I got it working: Rewriting the query inside a template file wouldn't work because the main query already found 0 results based on the wrong assumption that attachments should not be queried. Thus the template file doesn't even run but jumps to 404.php where everything is too late. So one has to ch...
How to create an attachments archive with working pagination?
wordpress
I hope this isn't a stupid question, but I can't find an answer. I just want to display (in the loop) what post format a post is in. I'm trying to avoid using a bunch of if / else if conditions. I'm not trying to restyle the post based on format, just display "Gallery" or "Quote" or whatever the current post format is,...
Try: <code> &lt;?php echo get_post_format_string( get_post_format() ); ?&gt; </code> EDIT Note, if you want a fail-safe output, try this: <code> &lt;?php if ( get_post_format() ) { echo get_post_format_string( get_post_format() ); } else { ehco 'Standard'; } ?&gt; </code> Or, if you want to store it in a variable: <cod...
Display Post Format as a String
wordpress
Last year, I built a movie festival website using "movie" as a custom post type. Now that the festival is over and we're getting ready for next year, how would I archive that content so that I can start adding movies for the coming festival? Thanks!
You could add a category for that custom type with the year number . So old movies will been archived into a category of 2010 , and newer one into a category of 2011. Also it will allow an easy way for your users to view and figure what year is a movie from.
Archiving custom post content?
wordpress
I've 3-4 Blogs 2 on same topics I want if i post on 1st blog then 2nd blog can fetch feeds automatically and save that in database as a post or Can anyone tell me how smashing network work when someone post in his blog smashing fetch feeds and excerpt and show it in smashing network and when user click on that post he/...
If you are looking for something free I use FeedWordPress on one of my site which works well. There is also a commercial plugin AutoBlogged . These are the two I know of, I'm sure others exist.
How to Fetch Rss Feeds From Other Websites
wordpress
I'm not sure if is wordpress itself or Tiny MCE that's doing it. But when switching between HTML and Visual editor it's adding <code> &amp;nbsp; </code> , and adding an extra one each time I switch back and forth. I don't even have a line break in the code, it seems to somehow be deciding where it wants to place them b...
All I use is <code> remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); </code> and that stops Wordpress from creating any extra markup. Are you copying and pasting your code from an external editor?
Wordpress automatically adding "&nbsp;"?
wordpress
I've run into this error today and I can't find anyway to get past it. Fatal error: Call to undefined function get_header() in /members/index.php on line 1 The site is running WP 3.2.1 and BuddyPress 1.2.9 and uses the Arras 1.5.1.2 theme. The error only appears on the BuddyPress index page ( http://towermix.com/home/m...
Not sure what the problem, but I moved the site to a new web host and all is well. It's resolved, but I really wish I knew what caused the weirdness to begin with, in case I run into it again. Thanks for your help, kaiser.
Fatal error: Call to undefined function get_header() and BuddyPress
wordpress
I wonder if someone would know how to query specific pages (not by id), lets say I create a custom field called "product", and I would like to query all pages with that custom field. Any Help? Kind Regards :)! UPDATE: So far I've found this solution thank u so much! so far I've found this solution <code> global $wp_que...
As you can see on http://codex.wordpress.org/Function_Reference/get_pages you can query by meta_key , so to query by <code> product </code> custom field, you will do something like this . <code> $args=array( 'meta_key' =&gt; 'product' ); $pages = get_pages( $args ); </code>
Query specific Pages
wordpress
I'm referencing an attached image in my header.php page which is displayed as a full screen background on my posts: <code> global $wp_query; $page_id = $wp_query-&gt;get_queried_object_id(); $background_image = get_post_meta($page_id, 'mb_background_image', true); $src = wp_get_attachment_image_src($background_image, '...
The $page_id variable wasn't defined in category.php so I changed it to this. <code> $background_image = get_post_meta($post-&gt;ID, 'mb_background_image', true); </code>
get_post_meta not working on category.php
wordpress
I'm using the following code to display images based on the category id: <code> &lt;?php if (is_category( 'web-design' )){ ?&gt; &lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/slider_webdesign.png" title="خدمات تصميم وتطوير المواقع" height="200px" width="960px" /&gt; &lt;?php }else if (is_category( ...
<code> is_category() </code> takes an array as arguments if you want to check for more than one category. But you can make it even easier with a check for existing files: <code> if ( is_category() ) { $slug = get_queried_object()-&gt;slug; $theme_path = "/images/slider_$slug.png"; $file = get_template_directory() . $th...
Generating images from an array of categories
wordpress
I am using Scribu's Posts 2 Posts plugin to connect posts with small galleries attached to an album post type. Everything works great, except that I cannot figure out how to merge the attachments to display together. Right now I am using the code below to display each gallery one below another. <code> $images = get_chi...
You will just have to call get_children() for each gallery: <code> $images = array(); foreach ( $gallery_posts as $gallery ) { $images = array_merge( $images, get_children( 'post_parent' =&gt; $gallery-&gt;ID, ... ) ); } </code>
How to show multiple attachements together with Scribu's Posts 2 Posts connector?
wordpress
I want to display comments using a Post slider plugin, but comments aren't posts. I had a dodgy setup with FeedWordPress (sydnication plugin) by sucking the Comments RSS feed in to to the Comments into Posts, but the RSS feed has mysteriously stopped updating. So I'm thinking it might be better to find a way to convert...
You can copy this code into a plugin and when activated will convert all comments into posts, and delete the comments (so you will not have duplicates) You can also limit what kind of comments will be converted the posts using the parameters for get_comments ( http://codex.wordpress.org/Function_Reference/get_comments ...
How to batch convert comments to posts?
wordpress
I've successfully redirected my blog page to my most recent post - i.e. so when you click the 'blog' link in the nav it goes to the most recent post page and you can click next/prev buttons to navigate between other posts. Now I want to do the same thing but for a specific category so when you click a category link, in...
You know, the other way to do what you're trying to do is simply to set the global <code> posts_per_page </code> variable to <code> 1 </code> in Dashboard -> Settings -> Reading .
Display most recent post in category instead of archive?
wordpress
Does anyone know how I can turn this: <code> &lt;div id="mySlides"&gt; &lt;?php query_posts('showposts=4&amp;cat=11'); ?&gt; &lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt; &lt;div&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="&lt; ?php the_title_at...
I think this is probably a more-involved question, but I'll try to answer it as-is. The following code will wrap each post's content in a <code> &lt;div&gt; </code> : <code> &lt;?php if (have_posts()) : ?&gt; &lt;?php while (have_posts()) : the_post(); ?&gt; &lt;div id="slide&lt;?php the_ID(); ?&gt;&gt; // Post content...
How to wrap posts into divs?
wordpress
Is it possible to only have a couple lines shown per post (or even 0 lines) on the homepage? Instead of dumping the whole article on the page?
Look somewhere after the " Loop " starts (it starts with <code> &lt;?php while( have_posts() ): the_post(); ?&gt; </code> ) in your <code> index.php </code> file. Find <code> &lt;?php the_content(); ?&gt; </code> and change it to <code> &lt;?php the_excerpt(); ?&gt; </code> . If you don't want any content, just remove ...
Show only preview of posts on the homepage?
wordpress
So I understand that the visual editor uses something called TinyMCE. How do I retrieve the html that the user selects from the visual editor? I am basically trying to create a button that gets the selected html and replaces it.
The visual editor (TinyMCE) has its own API and since its a JavaScript Based editor you can get the selection using JavaScript very easily <code> tinyMCE.activeEditor.selection.getContent(); </code>
Getting selected (highlighted) html from the Visual Editor on Edit Post page?
wordpress
Is it possible to have users populate a taxonomy meta box(es), using the post_tag or any custom taxonomies I create? The idea is to include users in a network into the taxonomy schema, which would bring the community together in a better way. I guess a more specific way to ask this is how would I add taxonomy meta boxe...
Best way to link taxonomies and users is to link the user account to a custom post type then link the taxonomy to the custom post type. Example: You can use the action user_register to automatically create a new post for every new user and then start linking everything. I have used this method on https://myyogaavenue.c...
Taxonomy Meta Box in User Profile?
wordpress
I have been put in charge of a site that have a lot (and i mean it) of core hacks, some are pretty easy, some are really hard to spot (like removing a do_action on <code> the_content </code> . So, my question is , how i would and remove the hacks the previous maintaners did, while adding the new features requested. Sho...
Pull down the copy of Wordpress from your client's server to your local. Download a clean zip of the version of Wordpress your client has installed. http://wordpress.org/download/release-archive/ From there, you will need to use a file comparison tool (i.e. Diff on Linux). You can also use GIT to find the difference in...
How would I compare and remove hacks to core?
wordpress
I'm trying to set the number of posts_per_page dynamically using my own variable. This code works fine: <code> query_posts( $query_string . "&amp;posts_per_page=" . $myvar ) // then display the loop using get_template_part( 'loop' ); </code> That works fine, but I would like to know how to do it using $wp_query instead...
<code> query_posts </code> will do the query again (destroy current wp_query and create a new one and then doing the query with the parameters you pass to it) To get the same behaviour after setting the new parameter with <code> set_var </code> you need to query the database again using something like this <code> $wp_q...
How to set posts per page using WP_Query()
wordpress
Trying to figure out how to have users created automatically when a network site is created. So currently when a new user registers, their account is created and their network site is created. That gives that new site one user already (the site's admin). But when that's created I'd like to also have 3 more users automa...
You can do that hooking into <code> wpmu_new_blog </code> and then creating the user if it does not exists, and adding that user to the blog being created. To do so, you will use a code like this ( only for 1 user) , as a network enabled plugin or on the main theme functions.php <code> add_filter('wpmu_new_blog','wpse_...
Have users created automatically when a network site is created
wordpress
I'm running a multisite network with 100+ themes installed and activated. Is there a way to manipulate the list of available themes in wp-admin so that certain themes appear in the list first? (a kind of "Featured" or "recommended") After the first 9 or so alphabetical as default would be fine. Obviously Googling the w...
Came up with a silly but effective measure to get certain themes at the front of the list. Because themes are listed alphabetically, it was possible to manipulate the output by changing the theme name, specifically by adding a symbol to the front of the theme name it will appear at the start of the list. I settled for ...
Manipulate list of themes in wp-admin
wordpress
I have a problem of widgets not showing up, trying to investigate why $wp_registered_widgets is empty. Can somebody tell me where it gets filled from the database? How can I find out why the default widgets are not set.
As you can see here , <code> $wp_registered_widgets </code> is defined in wp-includes/widgets.php (as expected). You should be able to debug it by doing something like this: <code> function yoast_print_active_widgets() { global $wp_registered_widgets; echo '&lt;pre&gt;'.print_r( $wp_registered_widgets, 1 ).'&lt;/pre&gt...
How/where is the global variable $wp_registered_widgets filled?
wordpress
Hey all i am having some problems with finding out where wordpress saves my pages. I have a default theme selected and have added a few pages. However, the links to them seem to show up all the same (page.com/about, page.com/contact, etc etc). They all have the same content no matter what page i view (even though each ...
Wordpress store your pages in mysql database MySQL -> YOUR-DATABASE-NAME -> wp_posts / Your-Prefix_posts -> post_type for pages wp_type=page &amp; for posts wp_type=post when you use wordpress visual editor it generates its own html but when you use HTML editors you can use your own HTML &amp; works fine.
Wordpress pages not working out correctly with HTML
wordpress
I want to add | (vertical lines) between the page links in the nav menu. What's the easiest way to do this?
The <code> wp_nav_menu </code> function supports multiple styling parameters, http://codex.wordpress.org/Function_Reference/wp_nav_menu For instance you can add a <code> $menu_id </code> and then style the CSS for each <code> &lt;li&gt; </code> along the lines of <code> border-right:1px solid; </code> . Another option ...
Editing the nav menu?
wordpress
Simply put: Should custom meta boxes be able to output shortcodes the same way as Wordpress' native post editor? Reason I ask is because Ive created my own custom meta box for inputting a shortcode from the Cart66 plugin in order to output an "Add To Cart" button but when I try - it only prints the text from the shortc...
Short answer: no . Shortcodes are for injecting content directly in the Post Content , by the user , via the Post Edit screen. If your data are coming from a metabox, you have other, better, more efficient, and easier-to-control means of injecting content into the Post Content: primarily, the <code> the_content </code>...
Should custom meta boxes be able to output shortcodes the same as Wordpress' native post editor?
wordpress
Im trying to do a redirect to a certain bp profile page but for some reason it keeps going to the home page on the login. this is my code im not entirely sure what the problem is and why it keeps going to the home page. <code> add_action('login_form', 'redirect_after_login'); function redirect_after_login() { global $r...
I was able to find success with this function from BP Redirect to Profile (see GitHub repository ): <code> &lt;?php /* Plugin Name: BP Redirect to Profile for Buddypress Description:Redirect user to their profile when they login Version: 1.1 Requires at least: BuddyPress 1.1 Tested up to: BuddyPress 1.2+wpmu 2.9.1 Lice...
Login redirect to certain bp profile page
wordpress
EDITED question to be more specific and added bounty in hopes someone has a solid coded solution: So, here is an interesting task I have been trying to find a solution for. I have added a bounty which I will award to the best solution in the form of working code. What I am trying to do here is utilize wordpress as the ...
To pre-populate the post if it's empty hook the the_editor_content filter -- this allows you to check if the post has any content. If not, then you can call the Wikipedia API and pull it in - -this will delay the post editor load, so a simple cache is implemented - depending on your use case, you may need to create a p...
Integrating custom API for post content into Admin interface & Public Website
wordpress
I would like to create a plugin which updates the post's content in the Admin panel. For example, on the Edit post page, the user sees his draft content. If he clicks on a button from a meta box plugin, I want new HTML to be appended to the post content. Ideally without refreshing the page. Zemanta does this and I am t...
This type of thing is most easily done from the TinyMCE editor through a plugin. Details of creating one using WordPress filters can be found here: http://codex.wordpress.org/TinyMCE_Custom_Buttons function myplugin_addbuttons() { // Don't bother doing this stuff if the current user lacks permissions if ( ! current_use...
What is the correct method for updating post content from a plugin?
wordpress
I'm working on a blog which migrated from wordpress.com, which now is self-hosted. I created a theme based off their CSS customizations, and everything is working. I'm looking to add the Facebook and Twitter buttons, to the end of posts and end of posts on front page. Essentially In the same manner as wordpress.com. I ...
Why go for a plugin at all?? all you want is twitter &amp; facebook share / tweet right ? You can do this: 1. embed this shortcode in your functions.php (or shortcode page if you got one) <code> function shreplz() { return ' &lt;div class="sharebox"&gt; &lt;div class="twittme"&gt;&lt;a name="fb_share"&gt;&lt;/a&gt; &lt...
Share buttons Facebook Twitter, just like wordpress.com without webservice
wordpress
The default search function if the search form is empty returns the home page, I want it to return a "sorry your search returned no results" page. stackexchange-url ("this post doesn't answer it") and this ticket tells me that it is supposed to function that way! Anyone figure out how to change it besides using a .htac...
Here are 3 ways of fixing this, I advise you use solution 2, but pay attention to the jQuery in solution 1 as a way of avoiding the situation in the first place. For those wanting more code posted from the question askers theme, this is not a theme issue, this is a general WordPress issue that affects all WordPress sit...
Empty search returns home page, how to return not found search page?
wordpress
Can you please help me? For getting post url I use: <code> &lt;?php the_permalink() ?&gt; </code> But for pages and for categories? If I use <code> &lt;?php the_permalink() ?&gt; </code> on categories it displays post url.
There's currently no way in core to get the current archive / category / tag / custom taxonomy URL. I have a patch waiting for that to be added right here . For now though, you could just use the code in the last patch on that ticket: <code> &lt;?php /* Get the current archive link * * @param $paged boolean whether or ...
permalink for category pages and posts
wordpress
I have a big one page wordpress site and a menu created from wordpress admin pages panel. I added everywhere in my main page such links like <code> &lt;A NAME="gohere"&gt; </code> and similar. Now I need to add href's to the page menu name's like <code> &lt;a href="#gohere"&gt; </code> Actually I do not know is it poss...
well you've to change code in loop for example currently now loop is like <code> &lt;?php if(have_post) : while(yourquery): the_post : &lt;div&gt;the_title&lt;/div&gt;&lt;div&gt;the_content&lt;/div&gt; endwhile; endif; </code> Then Just Add this line also <code> &lt;?php if(have_post) : while(yourquery): the_post &lt;a...
Is it possible to link to the same page from wordpress page menu?
wordpress
I found that the following code online could be used to spoof the WordPress uploads folder, rewriting URLs to a different folder on the server: <code> # BEGIN Spoof wp-content/uploads directory RedirectMatch 301 ^/uploads/(.*)$ https?://yoursite.com/wp-content/uploads/$1 # END Spoof wp-content/uploads directory </code>...
yes, this: <code> https?://yoursite.com </code> doesn't do anything you want, just make it <code> http://yoursite.com </code> . Next to that, make sure your server actually supports RedirectMatch.
How to rewrite WordPress uploads folder to another folder using htaccess
wordpress
I have a current job where my client has requested to have their "sponsors" rotate in the sidebar widget. Right now I have a random ad widget which rotates them randomly... I was wanting to know if there is a plugin or a way to make a number of image ads slide, or rotate live when you are on the page not via refresh an...
UPDATE I ended up using the promo slider plugin which you can get here it worked great. I customized the css slightly and its easy to use and easy to set to custom sizes. Its generally made for a full size slider, I just shrunk it down to 250x375 for my ad space. You can see it live in the bottom right of this site her...
Scrolling Ads? Live scrolling widget, not random on refresh
wordpress
I use a theme called vigilance I am starting to build my own themes and I notice in this them a lot of functions will have the theme name vigilance passed into the functions like this one below... <code> &lt;?php _e( 'This post is password protected. Enter the password to view comments.', 'vigilance' ); ?&gt; </code> N...
It's the text domain , for use in internationalization .
Theme name passed into some of the functions?
wordpress
My WP sites keep crashing my server because I have huge amounts of load in a short amount of time. The server has to be rebooted every few minutes. We have tried everything but nothing seems to work...would Amazon AWS Services be a good alternative? If so, which AWS services would work best?
AWS is good, but a bit hard to understand if you've never set up a server. You should take a look at http://rackspace.com for their cloud server package. It's about $25 USD/month for a decent server. They also have a control panel for load balancing setup. I've hosted a bunch of WP sites on my cloud servers there with ...
Would Amazon AWS Services be a good alternative to my current hosting provider?
wordpress
I am trying to be able to search a particular custom post type on my blog. The custom post type is named: website_bookmarks I have modified my search form with a hidden field <code> &lt;input type="hidden" name="post_type" value="website_bookmarks" /&gt; </code> So on my search page in the URI I will see... <code> www....
Could you check one thing for me: http://codex.wordpress.org/Function_Reference/register_post_type When you register <code> website_bookmarks </code> is: exclude_from_search ( boolean ) (importance) Whether to exclude posts with this post type from search results. Set to false ?
search this custom post type
wordpress
I'm going to be using a jQuery slider on my homepage only (not a WP plugin, but a third party). What I'd like to do is include jQuery, the plugin's jQuery script using a .js file, then include the script needed to fire the plugin right before the closing body tag. I'm a bit confused about how that works. I know WordPre...
You typically should use the jQuery version that's built in. There are instances where you might want to use wp_dequeue_script('jquery') and then add a different version of jQuery. Here's the best way to add a script dependent on jQuery: <code> function theme_register_scripts(){ wp_enqueue_script('jquery'); wp_enqueue_...
Best way to include jQuery and fire with script at bottom of container
wordpress
How can I make it so when the blog link in the nav bar is clicked it redirects to the most recent post? I know how to display just the latest post on the blog page, but I want it to actually redirect to the post page itself as I'm displaying a full screen background image called in via a custom metabox on each post pag...
You can use the get_posts() function: <code> &lt;?php /* Template Name: Redirect */ $args = array( 'posts_per_page' =&gt; '1', 'post_type' =&gt; 'post' ); $post = get_posts($args); if($post){ $url = get_permalink($post[0]-&gt;ID); wp_redirect( $url, 301 ); exit; } </code>
Redirect blog page to latest post?
wordpress
I'm using the ZigConnect plugin to set relationships between different types of posts. It appears that editors do not have the ability to remove connections, although this works fine for admins. How can I enable editors to remove connections? Also, I have the User Role Editor plugin installed, but I’m not sure which ca...
You could give the user the capability <code> manage_options </code> , however this will allow them to edit all options within wordpress. The best bet will be to change all the capabilites checks from <code> manage_options </code> to <code> level_7 </code> or some other editor capability(like <code> edit_others_posts <...
Zigconnect Plugin: Allowing editors to remove connections
wordpress
I just wanted to know if it's ok to modify/remove links pointing to the designer of the theme. In my case I have "theme by" and the site's logotype, would it be ok to remove the logotype and write the site's name? Or remove it altoghether? Does it have to do with the particular designer of the theme? Thanks
It depends on the license under which the Theme is released. Assuming the Theme was released under GPL: no; you are free to change the Theme in any way you want. If you redistribute the Theme, modified or unmodified, you are required to maintain the original copyright/license information in the Theme file headers , but...
Is it mandatory to have a link to the theme designer?
wordpress
I'd like to get a menu object from its theme location argument. My goal is to output separately the menu name and its items name, url and description. Example of what I'm looking for : <code> $menu = get_menu('nav-menu'); //get menu from its theme location echo $menu-&gt;name; //displays the menu name foreach($menu-&gt...
This method looks like what you're looking for , using get_nav_menu_locations() and get_term() : <code> $theme_locations = get_nav_menu_locations(); $menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' ); $menu_name = $menu_obj-&gt;name; </code> (See the link for the whole thing wrapped up in a custom fu...
Get menu object from theme_location
wordpress
The following code works brilliantly for retrieving certain pages, but I can't get it to retrieve POSTS by name. I'd like exactly the same code, but to retrieve posts rather than pages. Any help appreciated. <code> &lt;?php function get_my_content($page) { $my_id = $page; $post_id = get_post($my_id, ARRAY_A); $content ...
As per docs you only need to specify different post type to make it work: <code> $page = get_page_by_title('testpage', OBJECT, 'post'); </code>
WordPress Retrieve Post by Title
wordpress
Let me first explain what I am wanting to do... I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons. Can search my bookmarks by tags Can search my bookmarks by description and/or name Can access my bookmarks from anywhere Can add a description...
This is how i would go about it: Website Title - Post title. Website URL - custom field. Website Description - post content (editor). Bookmark Tags - custom taxonomy. Screenshot image - Post thumbnail. Seems simple enough.
How to do a custom bookmarks post type?
wordpress
I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to overwrite a lot of other pages too (search results, author results, etc.) So my plan is to create a single page similar to...
I would suggest taking a look at the Template Hierarchy structure to fully understand WHY archive.php overwrites certain pages (although it shouldn't overwrite search results) If you wanted to go a custom template direction (might be the best way) I would do something like this create a monthly-arcive.php file and past...
Simplest Way to Build Custom Archives Page?
wordpress
I am using a custom post type to allow the editor of the site to add a number of blocks of content to the site - infoboxes. Now i would like to give the editor the possibility to choose which boxes appear on which pages. So if i have defined page 1 and page 2 is there a way to allow the user to choose that on page 1 th...
One of two ways: Add a shortcode, so someone could drop in <code> [content-block id="12"] </code> wherever they wanted. Here's a very simple example without a lot of error checking. <code> &lt;?php add_action( 'init', 'wpse29418_add_shortcode' ); function wpse29418_add_shortcode() { add_shortcode( 'content-block', 'wps...
wordpress reusable content blocks
wordpress
I've asked this before but to no avail. I need the ability for any user (From Contributor up) of my website to upload a minimum of 5 and a maximum of 10 images to their profile and have they displayed immediately I'm sure there's a way to customize the User Photo plugin - http://wordpress.org/extend/plugins/user-photo/...
You can use Cimy User Extra Fields which will allow you to add as many fields as you'd like and currently supports: text textarea textarea-rich password checkbox radio drop-down picture picture-url registration-date avatar file
Allow users to upload multiple images to their profile
wordpress
I'm trying to create a small list of top commenters in my sidebar. I don't want to use a plugin, so I was googling for codes. All I could find was the following: <code> function top_comment_authors($amount = 5){ global $wpdb; $results = $wpdb-&gt;get_results(' SELECT COUNT(comment_author_email) AS comments_count, comme...
<code> $output .= "&lt;li&gt;".(($result-&gt;comment_author_url) ? "&lt;a href='".$result-&gt;comment_author_url."'&gt;" : "").$result-&gt;comment_author.(($result-&gt;comment_author_url) ? "&lt;/a&gt;" : "")." (".$result-&gt;comments_count.")&lt;/li&gt;"; </code> edit: to show the avatar before the name: <code> $outpu...
Show top commenters without using a plugin
wordpress
Are there any good reasons to pull Google's jQuery from their servers as opposed to using the one included with Wordpress? I'm confused as to why I might want to use Google's library. Doesn't Wordpress, with its frequent updates, keep the latest version? Or am I missing something? Thanks.
The big advantages are the Google CDN and the client side caching of the library. Your visitor will probably have a version of the jquery library in the browsers cache already, so he doesn't have to re-download the script from the local version used by WordPress. One big disadvantage by including the library from the c...
Googles jQuery: Are There Avantages to Using It?
wordpress
I'm using jQuery Supersized to display a full screen background slideshow on my blog, and I'm using mobile detection to serve a smaller version of the images to mobile devices so it will load faster. Which option do you think would be better? Use TimThumb to dynamically resize the image size and jpeg quality On upload ...
WordPress and TimThumb both use GD to resize images, so quality is going to be similar. GD's resize quality is not as good as Photoshop, you'll notice this especially in fine details. Both WP and TimThumb can be modified to use ImageMagick , WP via a plugin , TimThumb I think requires you edit the code directly, which ...
Image resizing - TimThumb vs convert on upload?
wordpress
Let's say I've created two custom post types, one called post_type_author and another called post_type_book. In each of these two custom post types, I've created a non-hierarchical taxonomy for tags. What is the best way to associate these two custom post type's taxonomies? Also, if I wanted to link these two along wit...
Create one taxonomy and share it across all post types. You won't be able to have the same slug across multiple taxonomies anyway, they have to be unique due to the way they're stored in the database. You can use the built in tags taxonomy with your custom post type by setting <code> 'taxonomy' =&gt; array('post_tag') ...
Associate Taxonomies Across Post Types
wordpress
Any way to disable post revision on specific post types only?
Remove the <code> revisions </code> property inside the <code> supports </code> parameter of <code> register_post_type() </code> . Example <code> $args = array( // ... 'supports' =&gt; array('title','editor','thumbnail','comments','revisions') ); register_post_type('book',$args); </code> Change to: <code> $args = array...
Disable revisions for a specific post type only?
wordpress
I've been having issues with this plugin . What it does is that as long as an image in your blog post has an "id", then every commenter can hover over the image and leave a note directly in the image/photo. It is syncronized with the WP comment system and so the image/phot note will appear as comment with a small thumb...
The problem is that the plugin is trying to echo data (re-sending the headers) after they have been sent. Here is line 178 of the plugin <code> echo "&lt;div id=\"comment-".$str."\"&gt;&lt;a href='#".$str."'&gt;noted on #".$imgIDNow."&lt;/a&gt;&lt;/div&gt;"; </code> I would need more information on which page the plugi...
Wordpress Plugin: Demon Image Annotation
wordpress
Obvious newbie question I'm sure. Working on a friend's site and trying to figure out how to add post_class to a query. Just adding works fine and adds the div, but I don't know how to get it to run the <code> "id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class(); ?&gt;" </code> part of it instead of echoing it. <c...
<code> post_class() </code> will echo the class in the format <code> class="postclassA postclassB" </code> <code> get_post_class() </code> will return an array of all registred classes To use <code> get_post_class() </code> inside <code> sprintf() </code> , you have to return the array as a string. For this purpose you...
Adding post_class into functions.php query
wordpress
When I'm creating a new post, just after clicking "Add New" , when the post editor shows, instead of having to use the dropdown and choose a custom field to use, I'd like to have some default custom field inputs already openend. Visually, instead of : I'd like to have something like : I know there are plugins for that ...
The action hook <code> save_post </code> is called on save, but i don't know if you can add metadata at this time. But it should be possible to create/update your meta data after the post was saved with the action hook <code> updated_post_meta </code> . EDIT To pre-select some meta fields (custom fields) on the post cr...
Is there a way to set default custom fields when creating a post?
wordpress
I am having troublle with setting my permalink in wordpress site. I changed the permalink from default to custome : <code> %postname% </code> . In this case my posts are working perfectly, but the pages are not. They generates a error 404 page not found. I've changed the .htaccess file permission, did everything, but n...
I figured it out! It was basically a mysql user privilege problem. For security reasons, I had switched off a lot of permissions, so it couldn't write the data. I gave the conflicting permissions and it worked! Thanks to Jeremy for his help!
Permalinks on post is working, on pages 404 error
wordpress
I'm using this function to prevent users apart from admin from getting to the backend of wordpress. (Note, that addition to allow ajax requests too): <code> add_action( 'init', 'my_block_users' ); function my_block_users() { $isAjax = (defined('DOING_AJAX') &amp;&amp; true === DOING_AJAX) ? true : false; if(!$isAjax) {...
Works on my side. Try disabling your plugins and test again. Btw. You could use <code> admin_init </code> instead of the <code> init </code> action hook. This way, the snippet will only be executed on admin requests. This way, you can remove the <code> is_admin() </code> check in the function.
wp-admin blocking causing http error on uploads
wordpress
I'm providing front-end login in a template, using the function wp_login_form. It handles the redirection after login and logout pretty neatly! But if the username / password mismatch, or are non existent, the user is redirected to the admin login page, with the shaky js error. Also same is the case when I'm trying to ...
Yes it's possible. You have to create three filters for this. Admin stuff inside a class <code> class WPSE29338_Admin { public static function setup() { add_filter('login_url', array(__CLASS__, 'modifyLoginURL'), 10, 2); add_filter('lostpassword_url', array(__CLASS__, 'modifyLostPasswordURL'), 10, 2); add_filter('regis...
How to show 'login error' and 'lost password' on my template page?
wordpress
I'm new to Wordpress and I'm trying to create a new theme for it. I've downloaded the latest version (3.2.1) and installed it successfuly. But when I install my wordpress theme (to start to add the PHP) and try to create a new post, what happens is that the Set Featured Image box disappears and it only shows again when...
What is happening is that your theme does not have support for featured image. What you need to do is add in the functions.php file of your theme the line : <code> if (function_exists('add_theme_support')) { add_theme_support( 'post-thumbnails' ); } </code> and then you will be able to use featured image in your theme
wordpress featured image
wordpress
I'm new to Wordpress and I'm trying to create a new theme for it. I've downloaded the latest version (3.2.1) and installed it successfuly. But when I install my wordpress theme (to start to add the PHP) and try to create a new post, what happens is that the Set Featured Image box disappears and it only shows again when...
The most simple form of the featured images (post thumbnails) looks like this: You need to have this piece of code in your functions.php file: <code> add_theme_support( 'post-thumbnails' ); </code> Then in the index.php, or any other template file you want to show the post thumb or featured images, you would add this: ...
wordpress featured image
wordpress
IN my blog, if I have a category and tag with the same name, it will make the tag have a number in the URI. Example: category/php tags/php-2 Is there anyway to make my tags with the same name as an existing category, to not append a number to the end of them for my links?
Tags and Categories use the same system, So that is not possible. It will not hurt SEO in any way to use php-2, it is just visually displeasing.
Category and tag with same name
wordpress
Is there an easy way to apply a function on all action hooks? I want to apply <code> esc_attr() </code> to every action hook (in a way that would work from functions.php or a plugin). I figure I would need to filter <code> do_action </code> and <code> do_action_ref_array </code> except that those functions don't use <c...
Just to answer the title Apply function on all action hooks? isn't that hard, when you know where to look: <code> add_action( 'all', 'callback_function' ); </code>
Apply function on all action hooks?
wordpress
Hi i am currently writing a WordPress plugin that i want to release to the public. I am having a few issues with URL rewrites however. I have got the plugin to redirect to the plugin page <code> add_action('template_redirect', 'myfuncdisplay') </code> to display custom output. I also have got the redirect working, <cod...
Parameter in <code> add_permastruct() </code> The third parameter of <code> add_permastruct() </code> is for the <code> is_front </code> parameter. This is a basename, which you can add to the default permalink structure of all your posts in the WordPress admin. For example, if you have set the permalink structure to <...
HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
wordpress
I would like to show a different sidebar for 2 specific posts(same custom post type). I understand how to do this using separate templates for different pages, but I want to have it all happen in the single-posttype.php page. Or am I thinking about this wrong? My end goal is to show different text widgets in the sideba...
I think Widget Logic is what you're looking for. It adds a field to each widget to allow you to specify which post get which widgets. It uses the standard Conditional Tags making it easy to use. You'd just want to do something like <code> is_single( 'Slug1-or-ID1' ) || is_single( 'Slug2-or-ID2' ) </code> You could also...
change sidebar or just widgets for 2 specific post type single posts
wordpress
I would like to have a level 1 menu in a vertical menu and a full menu in a vertical menu in the left sidebar in Twenty Eleven. My problem is that I would like to make the top item bold if the user is in it, or in one of it's child menues. The ideal solution would be to apply a rule for <code> .current_page_ancestor </...
Try adding the <code> .current-page-ancestor </code> selector to your style, note the use of hyphens instead of underscores.
.current_page_ancestor broken in Twenty Eleven
wordpress
I am using a version of this (http://www.deluxeblogtips.com/meta-box-script-for-wordpress/) meta box script but I want to be able to limit which edit screen a meta box shows. For example, if I only want a meta box to show in the "contact" page edit screen, is that possible? <code> $meta_boxes[] = array( 'id' =&gt; 'pro...
Inside your <code> add_meta_boxex </code> hook callback function, you will have an <code> add_meta_box() </code> call. Wrap that call in a conditional, using data from the <code> $post </code> global (I'm fairly certain it is available in <code> edit.php </code> ). For example, you could use either the Page ID or slug....
Can I limit this meta box to a particular page?
wordpress
Is there a way to automatically delete the default wordpress posts and pages when activating theme theme?
The following question gives you some insights how you can create an initialization script which should cleanup a fresh WordPress installation. It's not complete but it's a good startpoint. -> stackexchange-url ("Initialization Script for “Standard” Aspects of a WordPress Website?")
Automatically delete default posts and pages on theme install?
wordpress
I have no widgets available any ideas? I've tried the "Twenty Eleven" Standard Theme and the custom one (Lotus). No widgets are listed, I am looking for the custom_menu widget. In my other wordpress installation I have plenty of widgets available. Update : I use a multisite installation and I found that the blog_id in ...
Stupid mistake, I commented this out by mistake in wp-includes/widgets.php line 323: <code> function register($widget_class) { // $this-&gt;widgets[$widget_class] = &amp; new $widget_class(); } </code>
No "available widgets" (wordpress 3.2.1 multisite)
wordpress
I have code that looks like this: <code> $post_thumbnail = the_post_thumbnail( array ( $w, $h ) ); </code> I want to know what I'm doing wrong. When I pass in values for width and height, Wordpress returns an image with the correct hight but with the incorrect width. Is it possible for me to get the exact image specifi...
Always start with the Codex. According to the function reference for <code> the_post_thumbnail() </code> : Parameters $size (string/array) (Optional) Image size. Either a string keyword (thumbnail, medium, large, full), or any custom size keyword defined by add_image_size(), or a 2-item array representing width and hei...
Having trouble with the_post_thumbnail to display thumbnail with custom size
wordpress
What is the most complete WordPress shopping cart at the moment? GetShopped / Cart66 / Tribulant Shopping Cart ? Or something else?
For anyone who comes across this, after some research I'm going with Cart 66 which seems to be the hottest e-commerce plugin for wordpress sat the moment.
Best Shopping Cart for WordPress
wordpress
I've been able to leverage this super tutorial by @Bainternet in order to add custom fields for taxonomies. I've tweaked the markup, and added a separate callback to add fields to the "Add New Category" admin page. My code is at the end of this question. I've run into a gotcha though; the the custom field input is show...
Solved! <code> add_action( 'create_category', 'save_extra_taxonomy_fields', 10, 2 ); </code> Props to the Category Meta plugin . I downloaded various category meta plugins from the WP repo, and this one has the ability to add the meta data on the Add New screen. I dug through the code and found the elusive create_{term...
Add custom taxonomy fields when creating a new taxonomy
wordpress
Over time working on a local and development server I've accumulated some junk in my <code> wp-content/uploads folder </code> which are not in the database. The folder and database entry are fairly large and so I was wondering if there was a plugin or way to do some type of "garbage collection" and delete items in the ...
There is no easy way to do this. You could query the WP database for wp_posts that are media uploads and then run a script to match those again the files in the uploads folder, but even this would be a little shaky.
Plugin or method to delete uploads not in media library?
wordpress
How do you force the wordpress dashboard to be 1 coulmn by default? I want to show the dashboard as a single column for all users.
I found a promising looking answer to this question in the following post: http://wordpress.org/support/topic/customizing-admin-area-using-functionsphp-2-questions It recommends using this code in the functions.php file: <code> function so_screen_layout_columns( $columns ) { $columns['dashboard'] = 1; return $columns; ...
How do you force the wordpress dashboard to be 1 coulmn by default?
wordpress
I have the following conditional tag, which a friend helped me with... Currently it works doing.. 1) If a featured image just show that. 2) If images attached show featured image wrapped in a link to the images attached.. Can there be a third? 3) If meta data just a text input field rw_post-vimeo just show that, its a ...
So, I would refactor this a bit: <code> &lt;?php $featured = ( has_post_thumbnail() ? get_post_thumbnail() : false ); $first_img = false; $custom = false; if ( ! $featured ) { // No featured image; look for attached images and get the first one $attachments = get_children( 'post_type=attachment&amp;orderby=menu_order&a...
IF.. post meta show... Conditional Tag Help...?
wordpress
this is the correct solution <code> &lt;?php $meta_cat_name = get_post_meta( $post-&gt;ID, 'related blog articles', true ); if( !empty( $meta_cat_name ) ): $my_query = new WP_Query( array( 'category_name' =&gt; $meta_cat_name, 'posts_per_page' =&gt; 5, ) ); if ( $my_query-&gt;have_posts() ): while ( $my_query-&gt;have_...
<code> &lt;?php $metacatname = get_post_meta( $post-&gt;ID, 'related blog articles', true ); if(!(empty( $metacatname ))): $my_query = new WP_Query( array( 'category_name' =&gt; $meta_cat_name, 'posts_per_page' =&gt; 5, ) ); if ( $my_query-&gt;have_posts() ): while ( $my_query-&gt;have_posts() ) : $my_query-&gt;the_pos...
Display custom field only if it has a value
wordpress
I saw there's a Wordpress plugin that prevents people from using right click on text or images, called WP Protect . I was wondering if there's a way to hardcode it into Wordpress instead of using a plugin. What I'm worried about is mainly the images. Being able to mark text is perfectly fine with me. I tried to find tu...
This functionality is Plugin territory. I strongly believe that the WordPress core team will never consider such functionality for WordPress core. Besides: such functionality is also pointless. Anyone who wants an image badly enough is going to be able to get them. (They can disable javascript thereby defeating the Plu...
Right click&copy images: protection
wordpress
I'm interested in specifying different URL slugs for tags than the text they contain (e.g. changing the slug for a "QnA" tag to "questions-and-answers"). What's the easiest way of making and maintaining these changes for a large number of tags?
Dashboard -> Posts -> Post Tags Click Tag (or click "Edit" in the hover quick-menu) to edit the tag's details, including slug.
How can I edit the slugs of tags?
wordpress
On a category archive page , how do I determine what category the archive page is for? I need either the id or the slug of the category. I am not looking for <code> get_the_category() </code> . This will give me all categories of the posts on this page (which can be subcategories of the category that the page is for). ...
the ID of the current category will be available in the <code> cat </code> query var: <code> get_query_var('cat'); </code>
Determine the category that an archive-page is for
wordpress
So I had to fiddle allot with tag cloud to display it correctly. My script limits display to 5, and since I don't display all tags, I'd like wp to output list in descending order based on popularity. So if tag has most posts it will be displayed first, and so on... Is this possible? I have a hunch I've to modify get_th...
This is a little bit more complicated than I thought. But I did find this link Which should help you on your path. Minus the custom post types, the code should be what you are looking for.
post specific tag cloud, how to display in descending order from popular to less?
wordpress
i am modifying a P2 theme for a specific purpose, and it uses the <code> get_template_part( 'entry' ) </code> function to get the the whole entry html. What i then get is the who <code> &lt;li&gt; </code> element, but i want to be able to move things around [putting meta at the end of the post, for example]. but codex ...
Just looked in the P2 theme files. The theme loads the <code> entry.php </code> with the function <code> p2_load_entry() </code> located in <code> inc/template-tags.php </code> . If you want to edit the <code> entry.php </code> file and want to be on the safe side if P2 releases an update, you should create a Child The...
how to modify request to get_template_part()?
wordpress
I have an image gallery of sorts its displayed on the page using the following template code... <code> &lt;?php $featured = get_post_meta($post-&gt;ID,'_thumbnail_id',true); $attachments = get_children( 'post_type=attachment&amp;orderby=menu_order&amp;exclude='.$featured.'&amp;post_mime_type=image&amp;post_parent='.$po...
check how many posts were returned in your <code> $attachments </code> variable and output your desired markup for each case: <code> $featured = get_post_meta($post-&gt;ID,'_thumbnail_id',true); $attachments = get_children( 'post_type=attachment&amp;orderby=menu_order&amp;exclude='.$featured.'&amp;post_mime_type=image&...
If more than 1 image show post link?
wordpress
I've created a custom taxonomy. It's working just as expected, aside from it is not showing in the <code> get_taxonomies </code> array. <code> get_terms </code> function returns an <code> invalid taxonomy </code> error. I want to use <code> get_terms </code> to loop through the Double India Pale Ales and print each nam...
The <code> Invalid Taxonomy </code> error will be raised by the function <code> get_terms() </code> . You're registring your taxonomy on the <code> init </code> action hook. Therefore you have to call your <code> get_terms() </code> function on the same or a later hook. Try this snippet. It should display all term name...
Why is my working Custom Taxonomy not in get_taxonomies array?
wordpress
For some reason this is not working for me :( <code> $get_members = array( 'blog_id' =&gt; $GLOBALS['blog_id'], 'role' =&gt; 'sm_flagar', ); $blogusers = get_users($get_members); foreach ($blogusers as $user) { echo "&lt;li&gt;&lt;a href=\"".$user-&gt;user_url."\"&gt;". $user-&gt;first_name ." ". $user-&gt;last_name ."...
<code> first_name </code> and <code> last_name </code> are stored in the <code> usermeta </code> table. Therefore you have to use <code> get_user_meta() </code> to return these data. Try this code snippet: <code> $users = get_users(array( // blog_id is not required and will be set by WP_User 'role' =&gt; 'sm_flagar' ))...
trying to list users & display first - last name
wordpress
I would like to list posts by the "modified" date not the published date. Is there a way to do this? <code> $documents = array('posts_per_page' =&gt; 10, 'post_type' =&gt; 'documents',); query_posts( $documents ); get_template_part( 'loop', 'docid' ); wp_reset_query(); </code>
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters <code> 'orderby' =&gt; 'modified' </code>
How do I query based on the modified date?
wordpress
While I quite like the admin bar I actually want it to be OFF by default instead of ON ( I don't want to disable it altogether because I want users to be able to turn it on if they want - but but I don't want to have to manually turn it off for every user ) Is there a way to implement this.
<code> add_action("user_register", "set_user_admin_bar_false_by_default", 10, 1); function set_user_admin_bar_false_by_default($user_id) { update_user_meta( $user_id, 'show_admin_bar_front', 'false' ); update_user_meta( $user_id, 'show_admin_bar_admin', 'false' ); } </code> Place in theme functions file or you can make...
Change admin bar to default:off
wordpress
How do I import an existing Wordpress project into Aptana 3.04.2? I installed the Wordpress bundle in Aptana. I'm on a Mac running MAMP. My operating system is Leopard. My project is located at Sites-> mysite. I clicked "Import Project" Clicked "General" Selected "Existing Projects into Workspace" Clicked "Next" Select...
Ingo Muschenetz helped me out. This link provides the solution: http://wiki.appcelerator.org/display/tis/Importing+an+Existing+Project
How do I Import an Exisiting WP Project into Aptana 3?
wordpress
I'm using the GD Star Rating plugin and the bbPress plugin . The first plugin do have a argument to sort posts by number of votes. But unfortunately, It doesn't work with <code> WP_Query </code> (and apparently the bbPress loop uses it). That's why I wanted to create my own way of sorting custom post types in a custom ...
To order using post based custom fields you have to store your variable in an actual field using <code> add_post_meta </code> or <code> update_post_meta </code> , or manually add it to the post field. That way you can use <code> WP Query </code> to query the meta value for that field and order by the value. For example...
How to sort posts based on the value (number) of a post's metadata?
wordpress
Ok, So I have a wordpress installed on a test server. I just edited the default theme to get my desired result. My question is could I just install a new version of wordpress on another server and copy/paste my theme - simple as that?
If you haven't added a bunch of content and widgets on the local server, yes, it can be as easy as that. If you want to move everything - all your settings and content and such - you can follow these instructions: http://www.billerickson.net/how-to-move-your-wordpress-website/ G'luck!
Editing Theme and Moving Servers
wordpress
I'm trying to order the member list by display_name or first name ASC. http://sim.is/sim/felagatal-sim/ This doesn't seem to work. Any pointers out there? :/ <code> $users = get_users(array( 'role' =&gt; 'sm_flagar', 'orderby' =&gt; 'display_name', 'order' =&gt; 'ASC', )); foreach ($users as $user) { $firstName = get_u...
Here is my solution <code> function split_names( $name ) { $names = explode( " ", trim( join( " ", $name ) ) ); $first_name = array_shift( $names ); $last_name = array_pop( $names ); $middle_name = join( " ", $names ); return array( "first_name" =&gt; $first_name, "middle_name" =&gt; $middle_name, "last_name" =&gt; $la...
Order by first name
wordpress
I'd like to export my blog posts to plain text files so I can version control and update them using emacs org-mode via the org2blog package. However, I'm unfamiliar with SQL and the wordpress database structure. I'm hoping to get ideas for a SQL script to export my posts where each post is stored to a file named "YYYY-...
I ended up exporting my posts to xml (an option in wordpress) and using the org2blog-importer tool that was just created by the author of org2blog to get the files into the format I wanted.
export individual posts to text files or a single csv file
wordpress
I understand little about regular expressions, but I need to figure one out to use with the Redirection plugin which supports redirects with regular expressions. http://urbangiraffe.com/plugins/redirection/ What I need to do is redirect all urls in /oldsite/ to the domain root. That means any page in /oldsite/ like /ol...
Got it to work with this: <code> Source: /oldsite/(.*) Target: http://mydomain.com </code>
Redirection Plugin: Redirect all URLs with a regular expression
wordpress
I see lots of answers about moving entire blogs, but here's my scenario: I have a few blogs with a lot of content. I'm no longer publishing new content on these sites. I'm now publishing on another (new) site. I don't want to migrate all of the content from the previous sites, but I'd like to move a few "greatest hits"...
The best way of doing that is actually by just copying the post to your new blog, and on your old blog, add a rel="canonical" link to that page to your new post's URL. This will notify Google and other SE's that you want to have the other, new, page ranking, without actually having to annoy your users. There are severa...
How can I move/redirect single blog posts from one blog to another?
wordpress
I'm curious if there is a known issue with WordPress or PHP where the environment may degrade to a point where WordPress simply ignores calls to register_activation_hook(). I was pulling my hair out for an hour on my local environment running MAMP when I had a coworker test the code on her machine; exact same code work...
After a little more thought, I think using a resolved path lookup might be safer: <code> function plugin_symlink_path( $file ) { // If the file is already in the plugin directory we can save processing time. if ( preg_match( '/'.preg_quote( WP_PLUGIN_DIR, '/' ).'/i', $file ) ) return $file; // Examine each segment of t...
debugging register_activation_hook()
wordpress
Let me first explain what I am wanting to do... I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons. Can search my bookmarks by category Can search my bookmarks by tags Can search my bookmarks by description and/or name Can access my bookmarks...
Here's a clean way to accomplish what you need. Register custom post types (sans post_tags and categories) Register taxonomies specific to your bookmarks Create a post meta box for the bookmark options (sample included). You could add a nofollow checkbox option to the meta box. Save post meta Here's the whole shabang. ...
Website bookmarks as a custom post type
wordpress
Go to this link and click where it says "2 comments" in the sub-title: http://themeforward.com/demo2/2011/01/17/lobortis-tellus-diam/ When the link that brings the user to the comments is clicked it doesn't just scroll users down the page, it brings them to what APPEARS TO BE a separate page (even though it isn't a sep...
When links are broken into pages (via the settings in WordPress) and the link to bring a user to the comments is clicked it doesn't just scroll users down the page, it brings them to a separate page that is created. Yes; this is standard WordPress functionality. Paginating comments results in paginated posts , with an ...
Overflow and Comments
wordpress
What is best practice for WP with regard to using loop.php (loop-single.php, etc) versus looping inside the template file? Does it matter with regard to efficiency or ?
Depends on whether you would use that single-loop in more places. If you're only using it in one place and that will remain the case, do it within single.php, if you're going to be reusing it elsewhere, I'd highly suggest using a single-loop template part.
Loop.php vs looping inside template file
wordpress
I'm currently writing a plugin modifying the post content with the wp_insert_post_data filter. While doing that I would also like to add a post thumbnail using an external image url. It doesn't really matter if the image is hotlinked or copied to my wordpress installation. Anyone knows how to go about that?
you should have a look to this blog post : http://www.maverick.it/tech/create-thumbnails-using-wordpress-built-in-functions then, if you can't use a remote image, just download it as a temporary file on your server, process and delete it. One your image created, you should then insert it as an attachment (http://codex....
Add post thumbnail from external image with plugin
wordpress
My code takes the first sentence of a post and places it's content inside a variable. The problem is it works only inside the loop. I need help making this code outside the loop, becouse I want to use the posts first sentace as description in the header.php Here it is: <code> &lt;? ob_start(); the_content(); $old_conte...
To get post info outside the regular loop, you can use <code> WP Query </code> Reference In your example you can try something like; <code> $firstsentance = new WP_Query(); $firstsentance-&gt;query('posts_per_page=-1'); // add additional query parameters as needed, this will query all posts $old_content = the_content()...
Modify my code - which takes the first sentence of the post and use it as a h2 tag - to work outside the loop
wordpress