TutsMix
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Problens with wp_Query category FilterIf the code below doesn’t work, you’re doing something else wrong in that file:
<?php /** * @link http://codex.wordpress.org/Class_Reference/WP_Query */ $prefix_query = new WP_Query(array( // Use category slug, NOT name. 'category_name' => 'mangas', 'posts_per_page' => 2, // If get_query_var('paged') doesn’t work, try get_query_var('page'). 'paged' => max(1, get_query_var('paged')), )); if ($prefix_query->have_posts()) { while ($prefix_query->have_posts()) { $prefix_query->the_post(); echo get_the_title().'<br />'; } } else { echo 'No posts found.'; } wp_reset_postdata(); ?>Forum: Fixing WordPress
In reply to: Adding PHP into a shortcodeI’ve fixed your quotes:
<div><?php echo do_shortcode('[gdoc key="https://docs.google.com/spreadsheets/d/'.the_sub_field('google_doc_key').'/edit" gid="0"]'); ?></div>Forum: Fixing WordPress
In reply to: WP Query in functions.php returning only one entryYou should define
$return_stringoutside thewhileloop. Inside thewhileloop, you should append data to$return_string.Here, I’ve changed your function a little:
function client_flavors_slider_function($atts) { extract( shortcode_atts( array( 'posts' => 3, ), $atts, 'flavor-slider' ) ); $flavor_query = new WP_Query( array( 'category_name' => 'audio', 'posts_per_page' => $posts, ) ); $flavor_output = false; if ($flavor_query->have_posts()) { while ($flavor_query->have_posts()) { $flavor_query->the_post(); $flavor_output .= '<div class="item active">'; $flavor_output .= '<div class="featured-image col-sm-5">'.get_the_post_thumbnail().'</div>'; $flavor_output .= '<div class="post-content col-sm-5 col-sm-offset-2">'; $flavor_output .= '<h2>'.get_the_title().'</h2>'; $flavor_output .= '<p>'.get_the_content().'</p>'; $flavor_output .= '</div>'; $flavor_output .= '</div>'; } } return $flavor_output; }Forum: Fixing WordPress
In reply to: How to remove sidebar off of Single-Product PageI recommend you to create a child theme.
After that, in the functions.php file of that child theme, paste the code below:
<?php function remove_sidebar_from_product_pages() { if (is_product()) { remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10); } } add_action('template_redirect', 'remove_sidebar_from_product_pages');Don’t forget to activate the child theme.
Also, have a look at:
Forum: Fixing WordPress
In reply to: How to remove sidebar off of Single-Product PageAnd the code of the single-product.php file?
Forum: Fixing WordPress
In reply to: Displaying posts by category doesn't workI don’t understand exactly what you’re trying to do, but I’ve changed your code a little. It should work now.
<div class="one-column category-menu"> <?php wp_nav_menu(array( 'theme_location' => 'category-menu', )); ?> </div> <div class="four-columns"> <?php $category = get_query_var('cat'); query_posts('cat='.$category); ?> <?php if (have_posts()): ?> <?php while (have_posts()): ?> <?php the_post(); ?> <div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> <div class="entry"> <?php the_content(); ?> </div> </div> <?php endwhile; ?> <?php endif; ?> </div>Take a look at:
Forum: Fixing WordPress
In reply to: links in commentators' namesI recommend you to use a child theme.
NOTE: Replace theme-name with your theme’s name (e.g. twentyfourteen).
NOTE: Replace Theme Name Child with your theme’s name (e.g. Twenty Fourteen Child).1. Create a new directory called theme-name-child in the themes directory.
2. Create a new file called style.css in the theme-name-child directory.
3. Paste the code below in the style.css file./* Theme Name: Theme Name Child Template: theme-name */ @import "../theme-name/style.css";4. Create a new file called functions.php in the theme-name-child directory.
5. Paste the code below in the functions.php file.<?php function open_comment_author_link_in_new_window($link) { $link = str_replace('<a', '<a target="_blank"', $link); return $link; } add_filter('get_comment_author_link', 'open_comment_author_link_in_new_window');6. Activate the child theme from your Dashboard.
Forum: Fixing WordPress
In reply to: Problem with permalinks! Words like "the" doesn't show up!Those words are called “stop words”.
If you’re using the WordPress SEO by Yoast plugin, try this:
1. Go to the “SEO → Permalinks” section of the plugin.
2. Check or uncheck the box that says: “Remove stop words from slugs.”.Forum: Fixing WordPress
In reply to: How to exclude a post from my home page main query?Try using:
function add_my_post_types_to_query($query) { if ($query->is_home() AND $query->is_main_query()) { $query->set('post_type', array('post', 'custom')); $query->set('post__not_in', array(5)); } } add_action('pre_get_posts', 'add_my_post_types_to_query');Forum: Fixing WordPress
In reply to: YouTube and Vimeo videos not displaying in postsUsing a child theme:
1. Create the
twentythirteen-childdirectory in thethemesdirectory.
2. Create thestyle.cssfile in thetwentythirteen-childdirectory.
3. Paste the code below in thestyle.cssfile./* Theme Name: Twenty Thirteen Child Template: twentythirteen */ @import "../twentythirteen/style.css"; iframe { position: relative; z-index: 0; }4. Activate the child theme from your Dashboard.
Forum: Fixing WordPress
In reply to: YouTube and Vimeo videos not displaying in postsYou’re right @esmi, but the
style.cssfile has already been edited.Forum: Fixing WordPress
In reply to: YouTube and Vimeo videos not displaying in postsTry this:
Open the
style.cssfile and scroll to the bottom.Replace:
iframe { position: relative; z-index: -999 !important; }With:
iframe { position: relative; }Save the
style.cssfile and refresh the page.Forum: Fixing WordPress
In reply to: CSS change to effect specific page templateTry using:
.page-template-tpl-contact-php .section { width: 650px; }Forum: Fixing WordPress
In reply to: Getting the url of a featured imageTry using:
// Please note that this returns an array. $img = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');or
$img = wp_get_attachment_url(get_post_thumbnail_id($post_id));Forum: Fixing WordPress
In reply to: How to reduce server response time?Have you tried a caching plugin?