RedEyedTreeFrog
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Post Types, Pages and Permalink Structure ProblemSolved using archive template. In the custom post type declaration you have:
'has_archive' => true,So, instead of creating a page template, create an archive template named archive-{name of custom post type}. The permalink hierarchy built into WordPress will automatically show an index of your custom post types in the parent directory, e.g. example.com/events/ would be the listing and example.com/events/some-event would be an event. There is no name conflict this way. Just be sure in your archive template you have the following before the call to the loop:
<?php query_posts(array('post_type'=>'custom post type name')); ?>To call elements from the meta boxes you created in your custom post type and display them on the listing page, put the following right after the loop:
<?php $custom = get_post_custom($post->ID); $meta_box_one = $custom["meta_box_one"][0]; $meta_box_two = $custom["meta_box_two"][0]; ... ?>where “meta_box_one” (and two, etc.) are the names of your meta box variables defined in your custom post type functions. Display them using the following in your template markup anywhere within the loop:
<?php echo $meta_box_variable ?>My mistake was using a page template (thanks to the outdated tutorial I used) to display the listing of my custom posts. While that method does technically work, it does not allow for an orderly URL structure.
One more thing… using a dash (hyphen) in your custom post type name (e.g. “some-name”) makes wordpress break. Last I saw, they punted this issue out to v3.3+ so there will be no resolution any time soon.
Hope this helps someone!
Forum: Fixing WordPress
In reply to: Trouble with CustomPostTypesTry this:
Forum: Fixing WordPress
In reply to: Make links look betterIt looks like you are using open graph meta tags. To have text show up with your link, use the og:description tag. For example, right now you have <meta property=”og:description” content=”admin”/> on “http://www.teskedsorden.se/for-skolan/hur-man-botar-en-fanatiker/bestall-boken/”. When I paste the URL into my status box on Facebook, the description text is “admin” (without the quotes). Change the description here: <meta property=”og:description” content=”[Enter your description here]”/>
Same for the image. Use <meta property=”og:image” content=”[your image URL here]”/>. On the same page, you have that filled in correctly, but Facebook is pulling images from the home page (spoons picture). That one might be Facebook’s fault.