Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

GraphicArtisan on "Display only ONE category per "Page," for several pages."

$
0
0

I am creating a site that is currently on my localhost, so I can not provide a URL! I am using the BLANK-Theme by Chris Coyler, so the theme itself is bare.

I am trying to display only one category per page, for multiple pages. (ex. showing only DOG posts on the Dogs page, showing only CAT posts on the Cats page, etc.)

At first I was using:

<?php query_posts('cat=13'); ?>

Which technically works, but after further research I found that this isn't a very good solution (I also think it's messing with my Loop, since Page body content is no longer displaying). I looked into "pre_get_posts," but I read that that only works for the homepage -- and the homepage won't be displaying ANY posts.

I don't want to use Category pages because I feel that I don't have as much control over them; at the moment I have several different Page templates because each page functions a little differently and requires different features. I would like for each page template to display a different category (there are only 4 pages).

Is there a good way to do what I am looking to do? I have been researching for a while but I'm not entirely sure what I should be looking for. Thank you!


computersimple on "Separate Multiple Galleries in the same post"

$
0
0

Hi - I have a page with two galleries on it, the galleries have a separate list of images, but because they are in the same post they are merged together. Is there anyway to keep the galleries separated - so when a user clicks on one gallery they only see the images for that gallery and not all the images from all the galleries on that page? Thank you

chris@vendiadvertising.com on "Extending WP_Customize_Control in plugin throws errors"

$
0
0

I've created some additional types of customization controls for a theme using Otto's tutorial. I'd like to now package these into a plugin to share code across several sites. Using Otto's exact syntax in a plugin, however, throws a fatal error: Fatal error: Class 'WP_Customize_Control' not found...

<?php
/*
Plugin Name: WP_Customize_Control Error
Description: This plugin causes "Fatal error: Class 'WP_Customize_Control'" to be thrown
Author: Chris Haas
Version: 1.0
*/

class Example_Customize_Textarea_Control extends WP_Customize_Control
{
    public $type = 'textarea';

    public function render_content() {
        ?>
        <label>
        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
        <textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
        </label>
        <?php
    }
}

The simple solution would normally be to just include that core class using the below before the declaration:

require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );

This gets rid of the error until you go into Appearance->Customize where you get a different error, Fatal error: Cannot redeclare class WP_Customize_Color_Control in ... /wp-includes/class-wp-customize-control.php.

Ultimately this stems from wp-includes/class-wp-customize-manager.php line 70 (as of 3.9.1) where the file is loaded using require instead of require_once.

I found someone performing an on-demand load of their class in customize_register but that requires the theme to be aware of my plugin's file structure which isn't ideal.

Am I missing something obvious? Is there a good reason that that core file is loaded using require instead of require_once? As far as I can tell its a static class that could probably be loaded at almost anytime.

MRdanielP on "Template by post id?"

$
0
0

Hi,

I have done some php modifications to content.php to add some custom fields and images in posts.
I have 440 old posts that i don't want to apply this changes on.

What would be the easiest way to apply the new content.php on posts from id 441?

bite size on "ipage took website down off wordpress.org"

$
0
0

My Hosting came with Sitelock. $14.95..I have one tiny website. Back in Sept 2013 Sitelock didn’t like the page I made on my website, nor did they like me linking my server wordpress.org with a program called "Ten Minute Pages".
They said- “We have detected a critical cross-site scripting vulnerability at your site. From your dashboard, you can also take advantage of our Expert Services team to help you correct this issue and get your SiteLock certification back in good standing.”
What I was told from SiteLock was it would cost me hundreds$$$ to fix. What I was told and what was really the issue was two different things. After speaking with Sitelock, I realized they wanted an enormous amount of $$$$ and there was no such security breach. I called my hosting Co. and spoke to the manager and he agreed with me, sounded surprised and would speak to Sitelock would tell them they are no longer needed and I wouldn’t have to worry about it. Come- Jan 2014-sitelock sent the same email again. I called my hosting mgr again and he said he would take care of it.
Sitelock sent another email and so I responded- "This email is now considered harassment. You are on notice."

July 11th, 2014 my host sent me an email and shut my website down within 1/2 hour of the email. The email read- “There has been new activity on the iPage support ticket for your account.” Nothing else was said about shutting it down. I called and they said it was infected. Infected with what I don't know. But I paid for 2years of service, and still have months left.

The mgr I had been speaking to about this issue in January and September, is of course, no longer working for the company.
I had 3 malware checks today from 3 different companies and they all said it was free of malware and there was no hacking. The whole thing sounds just wrong. Where should I begin?

adblastbiz on "contact form 7 conditional redirect"

$
0
0

It took me to days of research and mostly trial and error until I got the conditional redirect for drop down options to work the way I wanted it. The example is for 2 different options in the drop down and then your otherwise main page you want people directed to if these two options are not picked. You can follow the pattern to add as many options as you want. I tested in chrome, ie, and ff... all work fine. I know many of you need this. pat on the back will be good enough. thanks. lol

replace youridnamenospaces with your form id and your drop down value spaces ok with what ever your full drop down value is.
http://yoururl.com/page1/ .... /page2/ with your pages as well as yoururl.com/page0/' with what ever page you would otherwise want people to land on.... cheers :)

on_sent_ok: " if (document.getElementById('youridnamenospaces').value=='your drop down value spaces ok') location = 'http://yoururl.com/page1/'; else if (document.getElementById('sameidnamenospaces').value=='your drop down option #2 spaces ok' ) location = 'http://yoururl.com/page2/'; else location.replace('http://yoururl.com/page0/');"

Deexgnome on "Query String / Month"

$
0
0

Hey,

i have a question to the query string. For the moment i use for posts
$my_query = new WP_Query('orderby=comment_count&showposts=3');

I have read http://codex.wordpress.org/Function_Reference/query_posts

but i'm not sure how to do it. What i would like to add is the command for yust display it for the comments of the current week.

I hope someone have a idea

Netfunkdesign on "SVN Help - Commit Forbidden"

$
0
0

I am having trouble to commit my plugin files to the repository.

I have read that usernames are case-sensitive and often the reason for this. I am sure I am using the correct login information.

Could my account just not be set to allow SVN access?

Plugin name: adbuddy-adblocker-detection


hossein.rahimi on "popular posts"

$
0
0

Hi
I am using this code to display popular posts on single posts:

<div class="top_app">
<h5>محبوب ترین ها نرم افزار ها ، بازی ها</h5>
</div><!--top_app-->
<div class="scroller">
    <ul id="mycarousel" class="jcarousel-skin-tango">
	<?php

$my_query = new WP_Query('orderby=comment_count&showposts=12');
while ($my_query->have_posts()):
$my_query->the_post();
$do_not_duplicate = $post->ID;?>
        <li>
		<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'popular-thumb' );
$url = $thumb['0'];
?><a href="<?php the_permalink() ?>"><img src="<?php echo $url; ?>" width="84" height="92" alt=""  title="<?php the_title(); ?>"></a></li><?php endwhile; ?>
    </ul>
</div><!--scroller-->

how I filter this list with category of posts?

Garebooo on "Using $var in condition tags."

$
0
0

Hello,

I am trying to use $var with the condition tags. I have added this code in my theme function file :

is_home(); {
$titles = 'page title';
$description = 'page description';
               }

it's worked fine but, when I repeat the code using is_category, is_single, is_tags ... etc. the $var like ( $titles ) still get the value of is_home. Could anyone please help me to fix this issue.

Thanks in advance,
Mansour

Luke Janicke on "get_user_meta() vs. get_userdata() vs. get_the_author_meta()"

$
0
0
  • get_user_meta()
  • get_userdata()
  • get_the_author_meta()

These three functions can all take a user ID and be used to retrieve things like Display Name and Email Address. It all seems a little redundant.

  • get_the_author_meta() retrieves one specified item for the author of the current post in the Loop or for the user specific by the given ID.
  • get_userdata() returns an WP_User object for the given user ID.
  • get_user_meta() can return a single item or an array of all items for the given user ID.

Does anyone have any general advice for where/how each would be best used?

I'm writing a plugin that sends an email to all editors when a post is published (a lite custom plugin). I need to retrieve names and email addresses for editors. I decided to use get_userdata(), since get_the_author_meta() doesn't make sense semantically (I'm not dealing with a post, just the fact that a user has the 'Editor' role), and dealing with the nested arrays of get_user_meta() is giving me a headache.

Luke Janicke on "Check my wp_mail() code? For a lite edit flow notifications plugin. (Github)"

HarryBerry94 on "Cycle2 Carousel with advanced custom fields"

$
0
0

Hello,

I am currently working on a Cycle2 Slider using Advanced custom fields. All my fields are set up. Basically I have a image that changes and a strap line and a logo above the strap line(All Images). My slider is displaying properly but does not seem to go through the images and instead stays on one image and does not change. If anyone could help it would be much appreciated

[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

<div id="slider">
    <!--Background Image!-->
    <img src="http://www.avactalifesciences.com/wp-content/uploads/2013/08/slide1.jpg" alt="slide 2 - Scientist image" class="back-slide" draggable="false">
    <div class="banner-blue-back">
        <div class="container">
            <div class="row">
                <div class="span8">

                    <div class="cycle-slideshow" data-cycle-fx=scrollHorz data-cycle-timeout=5000>
                        <!-- empty element for pager links -->
                        <div class="example-pager"></div>
                        <!-- Rotating Banner!-->
                        <?php if(get_field( 'slider_2')): while(has_sub_field( 'slider_2')): ?>

                        <?php $img_obj=get_sub_field( 'bg_image'); if($img_obj):?>
                        <img src="<?php echo $img_obj['url'] ?>" alt="<?php echo (empty($img_obj['alt'])? $img_obj['title'] :$img_obj['alt'])?>" />

                        <?php endif; ?>

                    </div>
                    <div class="example-pager"></div>
                </div>
                <!-- /.span8 -->

                <div class="span4 pull-right">

                    <?php $img_obj=get_sub_field( 'affimer_strapline'); if($img_obj):?>
                    <img src="<?php echo $img_obj['url'] ?>" alt="<?php echo (empty($img_obj['alt'])? $img_obj['title'] :$img_obj['alt'])?>" class="affimer-strapline" />
                    <?php endif; ?>
                    <hr class="thin">
                    <?php $img_obj=get_sub_field( 'strapline'); if($img_obj):?>
                    <img src="<?php echo $img_obj['url'] ?>" alt="<?php echo (empty($img_obj['alt'])? $img_obj['title'] :$img_obj['alt'])?>" />

                    <!-- <h3 class="strapline">Changing the way life sciences research is done</h3> -->
                </div>
                <!-- /.span4 -->

            </div>
            <!-- /.row -->
        </div>
        <!-- /.container -->
    </div>
    <!-- ./banner-blue-back -->

    <?php endif; ?>
    <?php endwhile; endif; ?>

iwt on "error after update : Warning: Missing argument 2 for wpdb::prepare()"

$
0
0

I update the WP version, and I am getting this error on top of the site and the admin section.

Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/65/6388800/html/domain/cms/wp-content/themes/cts/includes/widget_areas.php on line 154 and defined in /home/content/65/6388800/html/domain/cms/wp-includes/wp-db.php on line 1147

> this I have in the file on line widget_areas.php

/**
 * Register all custom sidebars
 *
 * @author Ohad Raz
 * @return Void
 */
function register_theme_sidebars_dynamic(){
    global $wpdb;
	//post and pages sidebars
	$widgetized_pages = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'omc_page_sidebar'"));

	if($widgetized_pages){
	    foreach($widgetized_pages as $w_page){
	        $widget_id = strtolower(str_replace(' ', '_', $w_page));
	        register_sidebar(array(
	            'name' => $w_page,
	            'id'   => 'jw_widgetsection_'.$widget_id,
	            'description'   => '',
	            'before_widget' => '<li id="%1$s" class="omc-widget %2$s">',
	            'after_widget' => '',
	            'before_title' => '<h3 class="widgettitle"><span>',
	            'after_title' => '</span></h3>'
	        ));
	     }// For each
	}//End If

> and bellow from wp-db.php

function prepare( $query, $args ) {
		if ( is_null( $query ) )
			return;

		// This is not meant to be foolproof -- but it will catch obviously incorrect usage.
		if ( strpos( $query, '%' ) === false ) {
			_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9' );
		}

		$args = func_get_args();
		array_shift( $args );
		// If args were passed as an array (as in vsprintf), move them up
		if ( isset( $args[0] ) && is_array($args[0]) )
			$args = $args[0];
		$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
		$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
		$query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
		$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
		array_walk( $args, array( $this, 'escape_by_ref' ) );
		return @vsprintf( $query, $args );
	}

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum's parser.]

<< Can anyone help?

Thanks in advance.

Gary Carlyle on "Unattach zero sized image posts?"

$
0
0

Hi,

I have made an autoposting plugin for TV shows but sometimes the image doesn't attach properly.

Is there anyway to unattached all the images that have a file size of zero,please?

~Gary.


xennex81 on "Display Posts in a tabbed array"

$
0
0

First decide how you want the html to function.

Are you going to create inline or inline-block span elements or li elements in some ul element so they will get horizontally displayed?

I don't know how to do anything called a 'carousel' but I think you just want a horizontal list?

Then when you have that list, how are you going to load the bio? Are you going to use JavaScript in the onClick handler for the images?

If you use pure HTML for that, it will require loading the entire team page with a new parameter each time. With JavaScript, you can load that bio dynamically in the browser.

But there are primarily two ways of doing that:

  1. load all bios in one go by having the page template for your team page (or the category template for your team category) do a WP_Query query on all of the posts (pretty much default behaviour for a category template) while creating unique IDs (possibly using array syntax) for identical HTML tags that contain the bio... and then using JavaScript to hide/unhide the various #ids.
  2. use AJAX calls to query a script that outputs a bit of HTML containing the bio, which is then loaded dynamically into the element that you have designated for showing the bio.

Personally I think the latter is a prettier solution but the former is probably easier at first sight.

In either case, I suggest using jQuery for doing it.

This is simple jQuery syntax for hiding an element and showing another:

$( "#elementid" ).css( "display", "none" );
$( "#elementid" ).css( "display", "inherited" );

This is simple jQuery syntax for setting the contents of an element:

$( "#elementid" ).html( javascriptVariable );

This is simple jQuery syntax for loading a PHP result into an element:

$( "#elementid" ).load( "obtain-bio.php?id=NNN" );

The benefits of method 1 is that after the page has loaded, it is very responsive. With method 2, each click on a picture will cause new data to be requested from the server.

I do not know what a "featured image" is and I would like to have something like that myself because I often include images that I want displayed as thumbnails in my excerpts in my posts, but supposing that you just randomly include one(1) image in each post, you could simply extract or filter that image by doing:

if (preg_match('@<img .*?(/>|</img>)@i', $post->post_content, $m) {
    $img =& $m[0];
    // do something with the image
} else {
    // display error about missing image
}

And to remove it from the contents so only the bio remains:

$bio = preg_replace('@<img .*?(/>|</img>)@i', '', $post->post_content);

This may leave a <p></p> paragraph if WP had inserted that. But it usually does so in a later stage. In fact, it only does so when you use the_content() to display your post. You can apply any filter before that by using the 'post_content' filter.

But there is also a feature in WP called "attachments". When you insert an image into a post, it adds that image as an attachment for that post, which is a child of the post in the parent-child hierarchy for posts. If you then remove the image link from the post content itself, the attachment remains.

So, you can also skip this filtering and just query the attachment when you want the image for a post:

$attachments = get_posts("post_type=attachment&numberposts=1&post_parent={$post->ID}");
if ($attachments) {
    $img = wp_get_attachment_image( $attachments[0]->ID, 'full' );
    // display the image in your container element
    echo "<li>$img</li>";
}

The reason I do not really like this solution is because I don't really feel to be in control of these attachments. They are weird parent-child objects existing as separate 'post' objects. I have no idea what their post content is (how is that defined?) and in fact their content is not defined but the link to the image exists in the "guid" field. Why someone would define something as a "post" object while then having no contents is beyond me.

The hierarchy thus described also seems to be limited to just two levels which means the attachments could simply have been described as objects in some "attachments" array defined by relationships described in a new (additional) relationships table or (if you want strict hierarchy) simply as the parents of those attachments objects in a new attachment table.

There is not actually a way (in 3.9.1) to edit these 'attachment' links all you can do is delete the object (the post object of type 'attachment' that is shown in the media library). It also means you cannot attach the same file to multiple posts which means I (in my own situation) will have to keep uploading the same image file again and again just so they can properly be 'attached' to the posts I want them for.

Which means I will probably be writing my own plugin using custom post fields (metadata) linking to unattached media library files instead of having them as child objects for single individual posts.

Essentially, for your (YST) use case it doesn't matter, I just don't like using this parent-child link to obtain the reference to the files, because if the implementation for this changes at some future moment, your code will cease working and because of that consideration I feel it is better to depend on your own solution which is simply the inclusion of an <img src="..." /> link into your post content.

That way your individual posts (if you provide a way to access them) still show the image (if you want that, you have to account for that).

But since you will exclude this category from normal post listings, that will not really be a consideration I would think.

So I would strongly suggest to just use this solution:

For the code that generates the 'carousel' just extract the <img> tag like this:

if (preg_match('@<img .*?(/>|</img>)@i', $post->post_content, $m) {
    $img =& $m[0];
    echo "<li>$img</li>\n";
}

You need onClick events for these images or their containing elements. Register them using:

$('#team-img-N').on('click',
    function (e) {
        changeBio(e.target.id);
    });

Then you have another JavaScript function "changeBio" that takes the element ID of your image tag (for instance) and uses it to effectuate the change you need according to the method you choose.

If, for example, all your elements are named "#team-pic-NNN" where NNN is the number of the post (its ID really in the WordPress database) you can use it to easily reference either the elements you want to hide/unhide or the URL of the bio snippet you want to load.

So you use a simple javascript function like substr to take the number out of the ID:

function changeBio(element) {
    id = element.substr(10);
    // do the hide/unhide, or the load
}

Then you need PHP to put those element IDs in some tags. It would seem easiest to give them to the <li> tags I've used as an example.

echo "<li>$img</li>\n"; becomes echo "<li id=\"#team-pic-{$post->ID}\">$img</li>\n";

After that you just need to ensure proper CSS styling and whatnot.

You could use a WP_Query loop to process all the posts in a category. Probably easiest is to just do a get_posts() with the required parameters and then looping over them with a foreach.

If you go the hide/unhide route you just iterate the array you get again when you create all of the (hidden) elements. If the hiding (display: none) of those elements does not disrupt the page flow (because their container element has a fixed size and uses scroll bars, or perhaps it doesn't matter) the hiding/unhiding should not be a big deal... I think.

So I think these are all the fundamental elements you need.

This is everything you need for the most basic solution.

For the AJAX retrieval route you just need a small PHP file that loads the WP environment:

<?php

require_once( dirname(__FILE__) . '/../wp-load.php' );

?>

If you put your obtain-bio.php script in /ajax/obtain-bio.php that snippet would load the WP environment provided those WP PHP files are in the website root.

Then all you need is to return the contents of the post excluding the image:

$param_id = $_GET['id'];
if ($param_id) {
    $post = get_post($param_id);
    if ($post && $post->post_status == 'publish') {
        // we want the post_content to be processed the way WP likes to do
        // but first remove the image
        $bio = preg_replace('@\n?<img .*?(/>|</img>)\n?@i', '', $post->post_content);
        // also removes a potential leading and trailing newline
        // apply default WP filters
        $bio = apply_filters('the_content', $bio);
        // echo raw text
        echo $bio;
    } else {
        echo "<p>Error in your script. $param_id is not a valid post ID in this WordPress installation.</p>";
    }
} else {
  echo "<p>This script requires a post-ID parameter</p>";
}

I've tested this last script and it works like a charm. Obviously it will return every valid published post, not just 'team' category posts.

So there you have it:

  • a HTML list containing the pictures
  • each picture element gets assigned a unique ID
  • for each such element a JavaScript event handler is assigned (the same code snippet for all elements)
  • the event handler calls a function that takes the element ID and uses it to change/load the bio for the required ID
  • the PHP code for the team page generates all those elements and IDs after obtaining a WP_Post array of the suitable posts
  • the image to display is extracted from the content of each post using a bit of regular expression matching
  • the remaining content to display has the image removed using a bit of regular expression replacing
  • you can choose whether to load everything at once or do lazy loading

I don't think there is much more to it. I believe you have all or most of the code you need, and what remains will be easy to adjust. You will have to learn how to load the jQuery library and how to insert JavaScript snippets that can get executed. That "changeBio" function you would place in the HTML <head> tag. The jQuery code to set the "click"-event handler can probably be expanded to set it for all required elements at once. If you need more help, let me know, but I expect you to take what you have now and try to make it work yourself.

Good luck! You will need it :).

ChelseaRushan on "How can we comapre prices of single product of different stores?"

$
0
0

I am developing an Ecommerce website that should have a price comparison feature that allows the user to select one product and the prices of that product at several stores are displayed and customer can chose the best store.How can I do that?Is there any plugin for that?

Thanks in advance!

golden_zenith on "Lightboxes and advanced custom fields"

$
0
0

Sorry in advance for the long post, but I've read just about everything out there on this topic and no dice. I want to make a custom lightbox and use it to display a person's name, image, and brief bio, with a dark gray overlay. So far I have this:

<?php
	$args = array('post_type' => 'team');
	$the_query = new WP_Query($args);
?>

<div id='imagegallery'>
<?php if ( have_posts() ) :
	while ( $the_query->have_posts() ) :
		$the_query->the_post(); ?>
		<a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';">
			<div class="member">
				<div id='member-img'><img src='<?php the_field('image'); ?>' alt='<?php the_field('name'); ?>' /></div>
				<div id='member-name'><?php the_field('name'); ?></div>
			</div>
		</a>

                <!-- Frustrating chunk of evil -->
		<a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">
			<div id="light" class="lightbox">
				<?php the_field('name'); ?>
				<img src="<?php the_field('image'); ?>" alt="<?php the_field('name'); ?>" />
				<?php the_field('description'); ?>
			</div>
			<div id="fade" class="overlay"></div>
		</a>
<?php endwhile; endif; ?>
</div>

There are a couple problems with this:

1) The imagegallery div contains all member divs, but it also contains the lightbox, which is not good because everything is squished in one parent div and has scrollbars all over the place. The lightbox should be essentially in the middle of the page, not the imagegallery div. I know this could be easy to fix, but that leads me to the next problem...

2) No matter which member div I click on, the lightbox that appears has all the information from the first member div. I understand this is because of the placement of my frustrating chunk of evil but if I move it outside the loop, then the lightbox that shows up only remembers the info from the last member div, which is essentially the same issue.

Is there any way I can access the field data outside of the WordPress Loop and use it to create a lightbox that shows up when I click on the corresponding member div?

joethall on "How to invoke a URL from a PHP plug-in?"

$
0
0

Need to create a PHP plug-in that can invoke a specific URL - http://.... - out on the internet. How can this be done?

lucaswp on "previous_posts_link and next_posts_link do not appear in custom query"

$
0
0

I have a page called "favoritos" where when the User is logged in, all the shows he selected favorite posts on the blog, however, my next_posts_link not appear

my favoritos.php

<?php
if(!is_user_logged_in()){
     $page = get_page_by_path( '/favoritos-2' );
     echo $page->post_content;
} else {
    global $favoritos, $query, $query_args;
    $query_args = array(
        'posts_per_page' => 32,
        'paged' => get_query_var( 'paged' ) ,
        'category' => -320,
        'post__in' => $favoritos
    );
    $query = new WP_Query($query_args);
    get_template_part('loop');
}
?>

and my loop.php

<?php global $query, $query_args;?>
<?php $count = 1; ?>
<?php if ($query->have_posts()) : ?>
    <div id="post-loop" style="min-height: <?php echo $_SESSION['AlturaContainer']; ?>px !important;">
        <div class="container" style="margin-left: 4%; width: 96% !important;" >
            <?php $post_counter = 0; ?>
            <?php foreach($query->get_posts($query_args) as $post): setup_postdata($post);  ?>

            <?php if ($post_counter < 33): ?>
                    <?php get_template_part('components/postbox', is_syndicated()  ? '' : 'old'); ?>
                <?php endif ?>
                <!-- FIM::POST -->				

                <!-- INI::ANUNCIO -->		

                            <!-- <section class="card front"> -->
                                <!-- <div class="post2"> -->
                                   <!-- <div class="picture" style="height:334px;width:250px"> -->
									<?php if ($count % 10 == 0){ ?>
									<div class="flippable">
										<div style="margin-left: 5px !important; margin-top: 40px !important;">
										<iframe name="InlineFrame1" id="InlineFrame1" width="350" height="300" src="http://www.gourmetlovers.com.br/wp-content/themes/gourmetlovers/boo-box.html" frameborder="0"></iframe>
										</div>

									</div>
									<?php } ?>
									<?php $count++; ?>
                                   <!-- </div> -->
                                <!-- </div> -->
                            <!-- </section> -->

                <!-- FIM::ANUNCIO -->
    <?php endforeach; ?>
            <div class="clear"></div>
            <div id="page-navigation">
                <?php if((is_home() || is_archive() || is_search() || is_page('favoritos') || is_page('blogs')) && $query->found_posts > 32): ?>
                <div class="bt-mais-post"><?php next_posts_link(" ")?></div>
                <div class="loader" style="text-align:center;float: none;">
                    <img alt="carregando" src="<?php echo get_template_directory_uri() ?>/images/loader.gif"/>
                    <label>Carregando...</label>
                </div>
                <?php endif; ?>
            </div>
        </div>

    </div>

<?php else : ?>
    <div class="page">
        <div class="container">
            <div id="post-main">
                <div class="entry-content">
                    <p>Nenhum resultado encontrado</p>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
<?php endif; ?>

I appreciate any help that someone can provide

Viewing all 8245 articles
Browse latest View live


Latest Images