Ervald
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How can I bulk delete all posts in a custom post type?No problem Nick,
You can mark this post as Solved now I guess.
Forum: Fixing WordPress
In reply to: Limit the Title CharacterWhy don’t you just echo the Title with a char limit?
ex.
$title = substr($post->post_title, 0, 40);Here’s how you do this.
Wordprpress Seo 1.0.3
class-sitemaps.php: Line 312
Find
if ( $images_in_sitemap ) {
Change with$post_type = get_post_type($p->ID); $images_in_sitemap = isset($options['xml_include_images']) && $options['xml_include_images']; if ( $images_in_sitemap && $post_type == 'post' ) {To set a checkbox option for admin.
class-config.php:Add after Line 996
$content .= $this->checkbox('xml_include_images', __("Add images to XML Sitemap."), false);Forum: Fixing WordPress
In reply to: How can I bulk delete all posts in a custom post type?Place this to a page:
// For Custom posts
<?php // Get 50 custom post types pages, set the number higher if is not slow. $mycustomposts = get_pages( array( 'post_type' => 'name-of-post-type', 'number' => 50) ); foreach( $mycustomposts as $mypost ) { // Delete's each post. wp_delete_post( $mypost->ID, true); // Set to False if you want to send them to Trash. } // 50 custom post types are being deleted everytime you refresh the page.?>// For terms
<?php $taxonomy = 'my_taxonomy'; $terms = get_terms($taxonomy); $count = count($terms); if ( $count > 0 ){ foreach ( $terms as $term ) { wp_delete_term( $term->term_id, $taxonomy ); } } ?>Forum: Fixing WordPress
In reply to: Adding WP blog to existing WP websiteThanks Ervald. Will it then automatically be formatted as a blog and ready to post to?
Yes.
If you want to change the look of the page, open yourtheme/index.php.
Line 267
class-sitemaps.php
Forum: Fixing WordPress
In reply to: Custom post type and taxonomy problemTry this:
$args=array( 'post_type' => 'people', 'post_status' => 'publish', 'posts_per_page' => 10, 'tax_query' => array( array( 'taxonomy' => 'departments' ) ); $my_query = null; $my_query = new WP_Query($args); // The Loop while ( $my_query->have_posts() ) : $my_query->the_post(); echo '<li>'; echo '<h4>'; //get term title echo '</h4>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata();Forum: Fixing WordPress
In reply to: Email all usersNo need for Plugin.
First get all user Emails, put them in array and use this function:
<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>Forum: Fixing WordPress
In reply to: Using the button to show/hide content for registered usersGetting the excerpt:
$post->post_excerptForum: Fixing WordPress
In reply to: Adding a custom field inside shortcode in my page templateCan you show us the code how the tab plugin shortcode is being generated?
Search for this add_shortcode in your tab plugin’s folder and it’s function.
Forum: Fixing WordPress
In reply to: How to add an "if" statement to this?You’re going wrong doing it that way. Still works but If is Home you’re left with empty <h1> tags.
Do it this way:
if(!is_front_page()) echo '<h1 id="post-'.the_ID().'>'.the_title().'</h1>'Forum: Fixing WordPress
In reply to: Pulling First Gallery Image into RSS Feedfunction add_thumb_to_RSS($content) { global $post; if ( has_post_thumbnail( $post->ID ) ){ $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content; } return $content; } add_filter('the_excerpt_rss', 'add_thumb_to_RSS'); add_filter('the_content_feed', 'add_thumb_to_RSS');To your functions.php
Forum: Fixing WordPress
In reply to: Adding WP blog to existing WP websiteCreate a page and call it ex. ‘Blog’
Then go to Settings>Reading , in ‘Front page displays’ select A static page (select below) and where it says ‘Posts page:’ choose ‘Blog’ (the page you created for the Blog).
Forum: Fixing WordPress
In reply to: I can't log in to my WP PageThe problem comes from your functions file: wp-content/themes/colourise/functions.php
Go to wp_config.php,
find
define(‘WP_DEBUG’, false);and turn it true
define(‘WP_DEBUG’, true);And see what errors come up when you enter /wp-admin
Forum: Fixing WordPress
In reply to: Pulling First Gallery Image into RSS FeedHere’s how to get the first attachment.
// If is not the Featured Thumbnail $args = array( 'post_type' => 'attachment', 'exclude' => get_post_thumbnail_id(the-post-id) ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { // echo them here } } //If is the Featured Thumbnail $image = wp_get_attachment_image_src( get_post_thumbnail_id(the-post-id), 'single-post-thumbnail' ); $imageURL = $image[0];http://codex.ww.wp.xz.cn/Function_Reference/wp_get_attachment_image_src