Oleg Dudkin
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Posts on page by categoryYou have 3 options:
1. Try to access https://your.site.com/category/nutricao – there should be category page with list of posts.2. Add
<?php $args = array( 'category_name' => 'nutricao', 'paged' = get_query_var('paged') ); query_posts( $args ); ?>
right after
<?php /* Template Name: Nutricao Posts Template */ ?>
In this case you need 1 template for each category.
3. Similar as above, but use this code to insert.
<?php global $posts; $args = array( 'category_name' => $posts[0]->post_name, 'paged' = get_query_var('paged') ); query_posts( $args ); ?>
In last case you need to name your page exactly like category is named. In your example – ‘nutricao’. But this template can be assigned to any number of pages.
Forum: Themes and Templates
In reply to: Posts on page by categoryWhy not to use WordPress built-in links to category pages?
Forum: Fixing WordPress
In reply to: Add jquery effects on default wp menuWordPress developers made jquery not to load as “$”.
There are different frameworks that also can reserve “$” sign for themselves. To avoid any collisions jQuery should be always reffered as “jQuery”.
Usually it’s not a problem – you still can use “$” inside such function:
jQuery(document).ready(function($) {
Forum: Fixing WordPress
In reply to: Site structure problemyou need no plugins at all.
Just use custom page templates.Forum: Fixing WordPress
In reply to: Add jquery effects on default wp menuTry to replace
$(document).ready(function() {
with
jQuery(document).ready(function(4) {
And also give a link to yout site, please.
Forum: Hacks
In reply to: How can i combine these 2 "query_posts into one output?Hi,
I think the best option is to combine query results after query was made.
E.g.global $wp_query; query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat)); $_t1 = $wp_query->posts; query_posts(array ('post_type' => 'page', 'orderby' => 'menu_order', 'order' => 'ASC', 'post__in' => (array) get_option('feat_pages'), 'showposts' => (int) $featured_num )); $wp_query->posts = array_merge( $_t1, $wp_query->posts ); $wp_query->post_count = count($wp_query->posts); // main loop here
I haven’t tested this, but code should do the trick.
Forum: Hacks
In reply to: Comparing Post Date with Current Date and Displaying Upcoming EventsHi,
Try next code:
$todaysDate = time() - (time() % 86400);
I see the source of problem.
'numberposts' => 4
you limit number of posts to 4.
Let’s say you have 4 future posts and 1 today’s post. = 5 in total.
get_posts will return only 4 posts : 3 future and 1 for today.
*today* means time when post was created, which of’course will be less than current time.
So we need to adjust todays time to be 1 second past yesterday’s midnight.Forum: Hacks
In reply to: Comparing Post Date with Current Date and Displaying Upcoming EventsJust noticed:
$postDate > $todaysDate | $postDate = $todaysDate
I think it should be
$postDate >= $todaysDate
or
$postDate > $todaysDate || $postDate == $todaysDate
Forum: Hacks
In reply to: Comparing Post Date with Current Date and Displaying Upcoming EventsTry this
$postDate = strtotime( $post->post_date ); $todaysDate = time();
Also there is no need to set todays date inside loop. You can do it once before foreach.
Forum: Fixing WordPress
In reply to: Fatal ErrorsThat was really bad idea to change core file. Especially when you don’t know PHP.
Forum: Fixing WordPress
In reply to: Tags and Pages are linking to an external site (was I hacked?)Did you noticed that redirecting appears only when post with embeded youtube is displayed?
It’s no looking like hack.
Just check which way are you embeding youtube video.
Turn autoembedding off to check.Forum: Fixing WordPress
In reply to: WordPress permalinks and SEO – what does google read?Default link will be redirected to “pretty” URL. Google will read it and show in search results.
Forum: Fixing WordPress
In reply to: Images Not Centering in PostsSpecify width for first image. 680 pixels.
Forum: Fixing WordPress
In reply to: Text widget: text appearing as linksImage link in widget is broken
<a href="https://www.amazon.com/?&tag=wesvirlantru-20&camp=211173&creative=374717&linkCode=ur1&adid=1FZV8DJHCFKR787W4C5C&"><img src="https://www.westernvirginialandtrust.org/images/AmazonLogo.gif" </img>
Should be
<a href="https://www.amazon.com/?&tag=wesvirlantru-20&camp=211173&creative=374717&linkCode=ur1&adid=1FZV8DJHCFKR787W4C5C&"><img src="https://www.westernvirginialandtrust.org/images/AmazonLogo.gif" /></a>
Forum: Fixing WordPress
In reply to: Display two posts when it should display one posttry this:
<?php $the_query = new WP_Query( 'post_type=brknews' ); $_count = 0; while ( $the_query->have_posts() ) : $the_query->the_post(); if (post_custom('breaking')) { the_title(); ++$_count; } endwhile; if ( ! $_count ) { echo 'None'; } wp_reset_query(); ?>