i'm developing a real estate page, you can check it out here. As you can see, the page take some time to load, because it loads all the 50 apartments/houses at once.
To speed up the page, i want to know if there is any way to delay the load, so the page load faster.
Here is the loop code, i'm wondering what could work, for example if i put some "if/else" condition before the wordpress make a loop (while ( $newsLoop->have_posts() ) : $newsLoop->the_post();?>), but i don't know how to do it. The ideal for me is that the contents are loaded 3 on 3, or "row by row", once a row have 3 apartments.
<div class="portfolio-items2">
<?php
$newsArgs = array(
'post_type' => 'property',
"orderby" => 'meta_value_num',
"meta_key" => 'numerooff',
"order" => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'property-status',
'field' => 'slug',
'terms' => 'oneoff',
)
)
);
$newsLoop = new WP_Query( $newsArgs );
while ( $newsLoop->have_posts() ) : $newsLoop->the_post();?>
<div class="col-md-4 shortcode-col listing_wrapper <?php meta('seletoroff');?>" >
<div class="property_listing" data-link="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
<div class="listing-unit-img-wrapper">
<div class="property_media"> </div>
<a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
<img width="525" height="350" src="<?php meta('imagemoff');?>" class="lazyload img-responsive wp-post-image" alt="" sizes="(max-width: 525px) 100vw, 525px" />
</a>
<div class="tag-wrapper"><div class="featured_div"><?php meta('porcentooff');?></div></div>
</div>
<h4>
<a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID,'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
<?php meta('titulooff');?>
</a>
</h4>
<div class="property_location_image">
<a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID,'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>" rel="tag">
<span style="font-size: 15px;"><?php meta('bairrooff');?> </span>
</a>
</div>
<br>
<div class="property_listing_details">
<?php
$post_meta_data = get_post_custom($post->ID);
if( !empty($post_meta_data['REAL_HOMES_property_size'][0]) ) {
$prop_size = $post_meta_data['REAL_HOMES_property_size'][0];
echo '<div class="inforoom">'. $prop_size .'m² <div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-size.png" style="max-width: 14%; height: auto;"></div></div>';
}
if( !empty($post_meta_data['REAL_HOMES_property_bedrooms'][0]) ) {
$prop_bedrooms = floatval($post_meta_data['REAL_HOMES_property_bedrooms'][0]);
$bedrooms_label = ($prop_bedrooms > 1)? __('Bedrooms','framework' ): __('Bedroom','framework');
echo '<div class="infobath">'. $prop_bedrooms .'<div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-bed.png" style="max-width: 17%; height: auto;"></div></div>';
}
if( !empty($post_meta_data['REAL_HOMES_property_bathrooms'][0]) ) {
$prop_bathrooms = floatval($post_meta_data['REAL_HOMES_property_bathrooms'][0]);
$bathrooms_label = ($prop_bathrooms > 1)?__('Bathrooms','framework' ): __('Bathroom','framework');
echo '<div class="infosize">'. $prop_bathrooms .'<div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-bath.png" style="max-width: 17%; height: auto;">
</div></div>';
}
?>
</div>
<div class="listing_unit_price_wrapper">
<span class="price_label price_label_before" style="text-decoration: line-through;">De: R$ <?php meta('valordeoff');?></span><br>
<span style="text-decoration: underline; font-size: 22px; font-weight: bold;">Por: R$ <?php meta('valoroff');?> </span>
<span class="price_label"></span>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
I've already installed some plugins, but none of them worked.
Related
On my main page, I have posts that underneath have the author name. Or well, should. However nothing actually appears and I'm not sure why they aren't showing. On my sidebar.php they do show up. I've tried to see if there was actually something appearing and not being hidden by CSS, however nothing appears at ALL from the get_the_author() on the front-page
Heres my front page code:
$result = wp_get_recent_posts(array(
'numberposts' => 1,
'category' => '',
'post_status' => 'publish',
));
foreach( $result as $p ){
?>
<!-- The card itself-->
<div class="card cardcustom">
<!-- The image -->
<img class="card-img tinted" src="<?php echo get_the_post_thumbnail_url($p['ID'], array(1438, 500)); ?>" style="height: 500px; object-fit: cover; border-radius: 0px;"/>
<!-- Text over the image -->
<div class="card-img-overlay card-content">
<p href="#" class="card-text the-badge badge badge-primary"><?php
foreach(get_the_category($p['ID']) as $category) {
echo $category->name . ' ';
}
?></p><br>
<p class="posttitle card-text" style="font-weight: 600; font-size: 16px;">
<?php echo $p['post_title']?></p><br />
<?php
$authorname = get_the_author();
echo '<p class="authortext card-text">From ' . '<strong class="colorauthor">' . $authorname . '</strong>' . '</p>';
?>
</div>
</div>
<?php
}
?>
And here is the code on my sidebar:
$result = wp_get_recent_posts(array(
'numberposts' => 8,
'category' => '',
'post_status' => 'publish',
));
foreach( $result as $p ){
?>
<!-- The card itself-->
<div class="card cardcustom">
<!-- The image -->
<img class="card-img tinted" src="<?php echo get_the_post_thumbnail_url($p['ID'], array(440, 240)); ?>" style="border-radius: 0px;"/>
<!-- Text over the image -->
<div class="card-img-overlay card-content">
<p href="#" class="card-text the-badge badge badge-primary" style="border-radius: 0px;"><?php
foreach(get_the_category($p['ID']) as $category) {
echo $category->name . ' ';
}
?></p><br>
<p class="posttitle card-text" style="font-weight: 600; font-size: 16px;">
<?php echo $p['post_title']?></p><br />
<?php
$authorname = get_the_author();
echo '<p class="authortext card-text">From ' . '<strong class="colorauthor">' . $authorname . '</strong>' . '</p>';
?>
</div>
</div>
<?php
}
?>
They're almost identical but for whatever reason it refuses to show up on the main page. You can see what I mean from the screenshots below:
MAIN PAGE:
https://gyazo.com/947f49090fd90a4068725a3968e1e205
SIDEBAR ON A DIFFERENT PAGE:
https://gyazo.com/b9325be19f388dc2d64ae2fe502e3ba4
get_the_author() uses the global $authordata.
And wp_get_recent_posts() doesn't alter the main query (because it uses get_posts() under the hood).
I guess on that sidebar it loads the author of the current page. To verify create another page with another user and try to see if the author changes.
I would suggest you get the author name by get_the_author_meta('display_name', $p->post_author); (replace get_the_author_meta with the_author_meta for simply displaying it).
We have a One Page website and we just created a 'Our Team' page (https://www.webovo.nl and go to 'Ons Team'). I added three social media buttons to the section-ourteam.php file. The problem is that i added 3 lines of codes to the div, but this way i am only able to add 3 links. Therefore, when i add my social media pages, all the buttons below every team-member icon have my social media pages.
I want to add different links to different team members. I understand it is a called member.thumb. How do i split the CSS so i can add individual links?
Can someone help?
Rick
P.S:
Look for the html remarks i made in the code. That is the code that i added myself. Below is the code that is currently in our section-ourteam.php file:
<?php
$onepress_team_id = get_theme_mod( 'onepress_team_id', esc_html__('team', 'onepress') );
$onepress_team_disable = get_theme_mod( 'onepress_team_disable' ) == 1 ? true : false;
$onepress_team_title = get_theme_mod( 'onepress_team_title', esc_html__('Our Team', 'onepress' ));
$onepress_team_subtitle = get_theme_mod( 'onepress_team_subtitle', esc_html__('Section subtitle', 'onepress' ));
$layout = intval( get_theme_mod( 'onepress_team_layout', 3 ) );
if ( $layout <= 0 ){
$layout = 3;
}
$user_ids = onepress_get_section_team_data();
if ( onepress_is_selective_refresh() ) {
$onepress_team_disable = false;
}
if ( ! empty( $user_ids ) ) {
$desc = get_theme_mod( 'onepress_team_desc' );
?>
<?php if ( ! $onepress_team_disable ) : ?>
<?php if ( ! onepress_is_selective_refresh() ){ ?>
<section id="<?php if ($onepress_team_id != '') echo $onepress_team_id; ?>" <?php do_action('onepress_section_atts', 'team'); ?>
class="<?php echo esc_attr(apply_filters('onepress_section_class', 'section-team section-padding section-meta onepage-section', 'team')); ?>">
<?php } ?>
<?php do_action('onepress_section_before_inner', 'team'); ?>
<div class="container">
<?php if ( $onepress_team_title || $onepress_team_subtitle || $desc ){ ?>
<div class="section-title-area">
<?php if ($onepress_team_subtitle != '') echo '<h5 class="section-subtitle">' . esc_html($onepress_team_subtitle) . '</h5>'; ?>
<?php if ($onepress_team_title != '') echo '<h2 class="section-title">' . esc_html($onepress_team_title) . '</h2>'; ?>
<?php if ( $desc ) {
echo '<div class="section-desc">' . apply_filters( 'the_content', wp_kses_post( $desc ) ) . '</div>';
} ?>
</div>
<?php } ?>
<div class="team-members row team-layout-<?php echo intval( 12 / $layout ); ?>">
<?php
if ( ! empty( $user_ids ) ) {
$n = 0;
foreach ( $user_ids as $member ) {
$member = wp_parse_args( $member, array(
'user_id' =>array(),
));
$link = isset( $member['link'] ) ? $member['link'] : '';
$user_id = wp_parse_args( $member['user_id'],array(
'id' => '',
) );
$image_attributes = wp_get_attachment_image_src( $user_id['id'], 'onepress-small' );
if ( $image_attributes ) {
$image = $image_attributes[0];
$data = get_post( $user_id['id'] );
$n ++ ;
?>
<div class="team-member wow slideInUp">
<div class="member-thumb">
<?php if ( $link ) { ?>
<a href="<?php echo esc_url( $link ); ?>">
<?php } ?>
<img class="img-center" src="<?php echo esc_url( $image ); ?>" alt="">
<?php if ( $link ) { ?>
</a>
<?php } ?>
<?php do_action( 'onepress_section_team_member_media', $member ); ?>
</div>
<div class="member-info">
<h5 class="member-name"><?php if ( $link ) { ?><?php } ?><?php echo esc_html( $data->post_title ); ?><?php if ( $link ) { ?><?php } ?></h5>
<span class="member-position"><?php echo esc_html( $data->post_content ); ?></span>
<!-- Code added by me -->
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-facebook fa-stack-1x fa-inverse"></i></span>
</div>
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-twitter fa-stack-1x fa-inverse"></i></span>
</div>
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-linkedin fa-stack-1x fa-inverse"></i></span>
</div>
<!-- the code below is not added by me -->
</div>
</div>
<?php
}
} // end foreach
}
?>
</div>
</div>
<?php do_action('onepress_section_after_inner', 'team'); ?>
<?php if ( ! onepress_is_selective_refresh() ){ ?>
</section>
<?php } ?>
<?php endif;
}
Based on your request here's a simple solution.
h5.member-name {
display: block;
margin: 0 0 5px;
}
.member-position {
margin: 0 0 15px;
display: block;
}
.fa-stack {
position: relative;
float: left;
margin: 0 10px 0 0;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="member-info">
<h5 class="member-name">MEMBER NAME</h5>
<span class="member-position">position</span>
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-facebook fa-stack-1x fa-inverse"></i></span>
</div>
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-twitter fa-stack-1x fa-inverse"></i></span>
</div>
<div class="address-contact">
<span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-linkedin fa-stack-1x fa-inverse"></i></span>
</div>
</div>
I'm trying to get further, new Image Links that are loaded to display.
Currently 5 are displayed, but we want to add a sixth & maybe 2 or 3 others in the future.
The issue we are having is when we add the sixth, it overwrites one of the existing 5.
Can anyone help with, what I suspect is the Function, to allow us to add more?
Thanks
HTML
<div class="content">
<div class="visible-xs visible-sm" style="background: #367586;color: white;width: 100%;">
<h2 style="color: white;padding: 20px;text-align: center;">Call us on <a style="text-decoration: none;color: white;" href="tel:0141999999">0131 344 4146</a></h2>
</div>
<div class="pageTitle">
<h1><?php single_cat_title(); ?></h1>
</div>
<?php
$posts = get_posts('category='.$cat);
vvwc_carouselList($posts);
?>
<div class="clearfix"></div>
PHP
function vvwc_carouselList($posts, $postId=null){
if(!empty($posts)){
echo '
<div class="nonCarousel">
<ul class="list-inline">
';
$x = 1;
foreach($posts as $post){
$active = '';
$feature = '';
if($postId == $post->ID){
$active = 'active';
$feature = 'feature';
}
if($x == 5 || $x == 1){
?>
<div class='row'>
<?php
}
echo '
<li class="col-md-3 '.$feature.'">
<div class="'.$active.' carousel-border">
<div class="carousel-item">
<a data-item="'.$post->ID.'" href="'.get_permalink($post->ID).'">
';
if(has_post_thumbnail($post->ID)){
echo get_the_post_thumbnail($post->ID);
}
echo "<div class='camperTitle'>" . strtoupper($post->post_title) . "</div>";
echo '
</a>
</div>
</div>
</li>
';
if($x == 4 || $x == count($posts)+1 ){
?>
</div>
<?php
}
$x ++;
}
echo '
</ul>
<div class="clearfix"></div>
</div>
';
}
echo '
<div class="clearfix"></div>
<script>
jQuery(document).ready(function($){
$(".carousel ul").owlCarousel({
items: 4,
pagination: false,
navigation: true,
navigationText: false,
slideSpeed: 1000,
rewindSpeed: 1000
});
});
</script>
';
}
Found it, I replaced:
$posts = get_posts('category='.$cat);
with
$posts = get_posts(array(
'category' =>15,
'orderby' => 'title',
'posts_per_page'=> 10,
'order' => 'ASC',
));
I've seen lots of questions and answers around how to do this but I am very stuck how I implement this into my webpage. I have a div named "banner" that contains an image drawn from a custom field that is on all my artist pages as a banner for each page. I would like to be able to drag this image inside the div and to save it's position. (I only want this function for myself, not visitors to the website) AKA Facebook page cover image.. This would allow me to add an image that is bigger than the div container to my custom field and for me to edit how this is showing inside the div.
This demonstates what I want to do- http://w3lessons.info/2014/08/31/facebook-style-cover-image-reposition-using-jquery-php/
but i don't understand where i put these codes in my wordpress files and how to make this work for me.. I only want this on my artist pages, and therefore using my single-artists.php template..
Here is my php code-
<?php
// artist download start
// if ( isset($_GET['download']) ) {
// header('Content-type: application/mp3');
// header('Content-Disposition: attachment; filename='.basename($_GET['download']));
// readfile( $_GET['download'] );
// }
// artist download end
get_header();
global $cs_transwitch,$prettyphoto_flag;
$prettyphoto_flag = "true";
$cs_artist = get_post_meta($post->ID, "cs_artist", true);
if ( $cs_artist <> "" ) {
$xmlObject = new SimpleXMLElement($cs_artist);
$cs_layout = $xmlObject->cs_layout;
$cs_sidebar_left = $xmlObject->cs_sidebar_left;
$cs_sidebar_right = $xmlObject->cs_sidebar_right;
}
if ( $cs_layout == "left" ) {
$cs_layout = "two-thirds column right";
$show_sidebar = $cs_sidebar_left;
}
else if ( $cs_layout == "right" ) {
$cs_layout = "two-thirds column left";
$show_sidebar = $cs_sidebar_right;
}
else $cs_layout = "sixteen columns left";
?>
<div id="banner">
<div id="bannercontent"><?php
list($src, $w, $h) = get_custom_field('banner:to_image_array');
?>
<img src="<?php print $src; ?>" width="100%" />
</div></div>
<script>$( "#bannercontent" ).draggable({
stop: function(){
alert('top offset: ' + $('#bannercontent').offset().top + ' left offset: ' + $('#bannercontent').offset().left);
}
});</script>
<div class="clear:both;"></div>
<div id="container" class="container row">
<div role="main" class="<?php echo $cs_layout;?>" >
<?php
/* Run the loop to output the post.
* If you want to overload this in a child theme then include a file
* called loop-single.php and that will be used instead.
*/
//get_template_part( 'loop', 'single_cs_artist' );
?>
<?php if ( have_posts() ): while ( have_posts() ) : the_post(); ?>
<?php
//showing meta start
$cs_artist = get_post_meta($post->ID, "cs_artist", true);
if ( $cs_artist <> "" ) {
$xmlObject = new SimpleXMLElement($cs_artist);
$cs_layout = $xmlObject->cs_layout;
$cs_sidebar_left = $xmlObject->cs_sidebar_left;
$cs_sidebar_right = $xmlObject->cs_sidebar_right;
$artist_release_date = $xmlObject->artist_release_date;
$artist_social_share = $xmlObject->artist_social_share;
$artist_buy_amazon = $xmlObject->artist_buy_amazon;
$artist_buy_apple = $xmlObject->artist_buy_apple;
$artist_buy_groov = $xmlObject->artist_buy_groov;
$artist_buy_cloud = $xmlObject->artist_buy_cloud;
}
//showing meta end
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="heading"><?php the_title(); ?></h1>
<div class="in-sec">
<?php
// getting featured image start
$image_id = get_post_thumbnail_id ( $post->ID );
if ( $image_id <> "" ) {
//$image_url = wp_get_attachment_image_src($image_id, array(208,208),true);
$image_url = cs_attachment_image_src($image_id, 208, 208);
$image_url = $image_url;
//$image_url_full = wp_get_attachment_image_src($image_id, 'full',true);
$image_url_full = cs_attachment_image_src($image_id, 0, 0);
$image_url_full = $image_url_full;
}
else {
$image_url = get_template_directory_uri()."/images/admin/no_image.jpg";
$image_url_full = get_template_directory_uri()."/images/admin/no_image.jpg";
}
//$image_id = get_post_thumbnail_id ( $post->ID );
//$image_url = wp_get_attachment_image_src($image_id, array(208,198),true);
//$image_url_full = wp_get_attachment_image_src($image_id, 'full',true);
// getting featured image end
?>
<div class="light-box artist-tracks artist-detail <?php if($image_id == "") echo "no-img-found";?> ">
<div id="main-container">
<div id="leftcolumn">
<a rel="prettyPhoto" name="<?php the_title(); ?>" href="<?php echo $image_url_full?>" class="thumb" >
<?php echo "<img src='".$image_url."' />";?>
</a>
<br>
<br>
<div id="inpostgallery"><?php echo do_shortcode('[inpost_gallery thumb_width="104" thumb_height="104" post_id="' . get_the_ID() . '" thumb_margin_left="0" thumb_margin_bottom="0" thumb_border_radius="2" thumb_shadow="0 1px 4px rgba(0, 0, 0, 0.2)" js_play_delay="3000" id="" random="0" group="0" border="" type="yoxview" show_in_popup="0" artist_cover="" artist_cover_width="200" artist_cover_height="200" popup_width="800" popup_max_height="600" popup_title="Gallery"][/inpost_gallery]'); ?></div>
</div>
<div id="rightcolumn">
<div class="desc">
<p style="font-size:12px;"><span class="bold" style="text-transform:uppercase; color:#262626;"><?php _e('Categories', CSDOMAIN); ?> :</span>
<?php
/* translators: used between list items, there is a space after the comma */
$before_cat = " ".__( '',CSDOMAIN );
$categories_list = get_the_term_list ( get_the_id(), 'artist-category', $before_cat, ', ', '' );
if ( $categories_list ): printf( __( '%1$s', CSDOMAIN ),$categories_list ); endif; '</p>';
?>
</p>
<br>
<h5><?php print_custom_field('stars:formatted_list', array('<li><img src="http://www.entertaininc.co.uk/wp-content/uploads/2015/09/gold-star-graphic-e1441218522835.png">[+value+]</li>','<ul>[+content+]</ul>') );
?></h5><br />
<h2><strong>Price</strong> <?php print_custom_field('price'); ?></h2> <br />
<h2><strong>Location</strong> <?php echo do_shortcode('[gmw_post_info info="city, country" divider=","]'); ?></h2><br />
<h4><?php _e('Description', CSDOMAIN); ?></h4>
<div class='txt rich_editor_text'>
<?php
the_content();
?>
</div>
<div class="clear"></div>
<?php edit_post_link( __( 'Edit', CSDOMAIN ), '<span class="edit-link">', '</span>' ); ?>
</div></div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="in-sec">
<div class="artist-opts">
<div class="share-artist">
<?php
$cs_social_share = get_option("cs_social_share");
if($cs_social_share != ''){
$xmlObject_artist = new SimpleXMLElement($cs_social_share);
if($artist_social_share == 'Yes'){
social_share();
}?>
<?php }?>
</div>
<?php if($artist_buy_amazon != '' or $artist_buy_apple != '' or $artist_buy_groov != '' or $artist_buy_cloud != ''){?>
<div class="availble">
<h4><?php if($cs_transwitch =='on'){ _e('Buy This',CSDOMAIN); }else{ echo __CS('buy_now', 'Buy This'); }?></h4>
<?php
if ( $artist_buy_amazon <> "" ) echo ' <a target="_blank" href="'.$artist_buy_amazon.'" class="amazon-ind"> <span>';if($cs_transwitch =='on'){ _e('Amazon',CSDOMAIN); }else{ echo __CS('amazon', 'Amazon'); } echo '</span></a> ';
if ( $artist_buy_apple <> "") echo ' <a target="_blank" href="'.$artist_buy_apple.'" class="apple-ind"> <span>'; if($cs_transwitch =='on'){ _e('Apple',CSDOMAIN); }else{ echo __CS('itunes', 'iTunes'); } echo '</span></a> ';
if ( $artist_buy_groov <> "") echo ' <a target="_blank" href="'.$artist_buy_groov.'" class="grooveshark-ind"> <span>'; if($cs_transwitch =='on'){ _e('GrooveShark',CSDOMAIN); }else{ echo __CS('grooveshark', 'GrooveShark'); } echo '</span></a> ';
if ( $artist_buy_cloud <> "") echo ' <a target="_blank" href="'.$artist_buy_cloud.'" class="soundcloud-ind"> <span>'; if($cs_transwitch =='on'){ _e('SoundCloud',CSDOMAIN); }else{ echo __CS('soundcloud', 'SoundCloud '); } echo '</span></a> ';
?>
</div>
<?php }?>
<div class="clear"></div>
</div>
</div>
<?php
foreach ( $xmlObject as $track ){
if ( $track->getName() == "track" ) {
?>
<div class="in-sec">
<?php
enqueue_alubmtrack_format_resources();
?>
<div class="artist-tracks light-box">
<?php
$counter = 0;
foreach ( $xmlObject as $track ){
$counter++;
if ( $track->getName() == "track" ) {
echo "<div class='track'>";
echo "<h5>";
echo $artist_track_title = $track->artist_track_title;
echo "</h5>";
echo "<ul>";
if ($track->artist_track_playable == "Yes") {
echo '
<li>
<div class="cp-container cp_container_'.$counter.'">
<ul class="cp-controls">
<li><a style="display: block;" href="#" class="cp-play" tabindex="1"> <span>'; if($cs_transwitch =='on'){ _e('Play',CSDOMAIN); }else{ echo __CS('play', 'Play'); } echo '</span></a></li>
<li> <span>'; if($cs_transwitch =='on'){ _e('Pause',CSDOMAIN); }else{ echo __CS('pause', 'Pause'); } echo '</span></li>
</ul>
</div>
<div style="width: 0px; height: 0px;" class="cp-jplayer jquery_jplayer_'.$counter.'">
<img style="width: 0px; height: 0px; display: none;" id="jp_poster_0">
<audio src="'.$track->artist_track_mp3_url.'" preload="metadata" ></audio>
</div>
<script>
jQuery(document).ready(function($){
var myCirclePlayer = new CirclePlayer(".jquery_jplayer_'.$counter.'",
{
mp3: "'.$track->artist_track_mp3_url.'"
}, {
cssSelectorAncestor: ".cp_container_'.$counter.'",
swfPath: "'.get_template_directory_uri().'/scripts/frontend/Jplayer.swf",
wmode: "window",
supplied: "mp3"
});
});
</script>
</li>
';
}
if ($track->artist_track_downloadable == "Yes"){ echo '<li> <span>'; if($cs_transwitch =='on'){ _e('Download',CSDOMAIN); }else{ echo __CS('download', 'Download'); } echo '</span></li>'; }
if ($track->artist_track_lyrics <> "") { echo '<li> <span>'; if($cs_transwitch =='on'){ _e('Lyrics',CSDOMAIN); }else{ echo __CS('lyrics', 'Lyrics'); } echo '</span></li>';}
if ($track->artist_track_buy_mp3 <> ""){ echo '<li> <span>'; if($cs_transwitch =='on'){ _e('Buy Song',CSDOMAIN); }else{ echo __CS('buy_now', 'Buy Song'); } echo '</span></li>';}
echo "</ul>";
echo '
<div id="lyrics'.$counter.'" style="display:none;">
'.str_replace("\n","</br>",$track->artist_track_lyrics).'
</div>
';
echo "</div>";
}
}
?>
<div class="clear"></div>
</div>
</div>
<?php
}
}
?>
<div class="clear"></div>
<?php if ( get_the_author_meta( 'description' ) ) :?>
<div class="in-sec" style="margin-top:20px;">
<div class="about-author">
<div class="avatars">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'PixFill_author_bio_avatar_size', 53 ) ); ?>
</div>
<div class="desc">
<h5><?php _e('About', CSDOMAIN); ?> <?php echo get_the_author(); ?></h5>
<p class="txt">
<?php the_author_meta( 'description' ); ?>
</p>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
<?php endif; ?>
</div>
<?php endwhile; endif; // end of the loop. ?>
<?php comments_template( '', true ); ?>
</div>
<?php if( $cs_layout != "sixteen columns left" and isset($show_sidebar) ) { ?>
<!--Sidebar Start-->
<div class="one-third column left">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($show_sidebar) ) : ?>
<?php endif; ?>
</div>
<!--Sidebar Ends-->
<?php }?>
<div class="clear"></div><!-- #content -->
</div><!-- #container -->
<div class="clear"></div>
<?php get_footer(); ?>
You need to use jQuery UI library (draggable) - https://jqueryui.com/draggable/
And then read the offset of the div or so
You also can use a jquery plugin named draggabilly. See the event dragMove or dragEnd. Hope it helps.
EDIT 01-28-13: Revised to clarify my question.
I'm using Magento 1.7.0.0 and FishPig WP full integration. We have successfully listed products from specific category and from all categories but was wondering if we can exclude in some cases from specified category. I found solutions to do this in functions.php within WordPress but this does not seem to work.
Here is the current code that displays posts from all categories. We'd like to add an exception so WordPress 1 Category can be excluded.
Here is the code that displays from all categories which I'd like to NOT include category "Press_HomePage":
$col_posts = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter();
$posttotal = count($col_posts->getAllIds());
$posttotid = $col_posts->getAllIds();
//i<=2 means displays last 2 posts
//display latest 2 posts...
for ( $i=1; $i<=2; $i++ )
{
?>
<div class="blog">
<h2><?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getPostDate(); ?></h2>
<h1><?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getPostTitle(); ?></h1>
<div style="float:left; margin-top:15px; margin-bottom:25px;">
<?php
$featured_img = $this->getSkinUrl('images/pree_emty.png');
if($featuredImage = $col_posts->getItemById($posttotid[$posttotal-$i])->getFeaturedImage())
{
$featured_img = $featuredImage->getAvailableImage();
}
?>
<img style="float: left;" src="<?php echo $featured_img; ?>" width="204" height="204" alt="" />
<div style="float: left; width: 580px; padding: 10px;">
<p><?php echo substr(strip_tags($col_posts->getItemById($posttotid[$posttotal-$i])->getPostContent()), 0, 400); ?></p>
<p>
<a href="<?php echo $col_posts->getItemById($posttotid[$posttotal-$i])->getUrl(); ?>">
<img src="<?php echo $this->getSkinUrl('images/view_btn.jpg'); ?>" width="170" height="32" alt="" />
</a>
</p>
</div>
</div>
</div>
<?php
}
?>
Let me know if I need to clarify myself. I appreciate your time.
//loki - get all the post ids
$col_posts = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter();
$posttotid = $col_posts->getAllIds();
//loki - get all the press ids
$col_posts_press = Mage::getResourceModel('wordpress/post_collection')->addIsPublishedFilter()->addCategorySlugFilter('press_homepage');
$posttotid_press = $col_posts_press->getAllIds();
//loki - removing the press_homepage category from array and reindexing
$blogposts = array_diff($posttotid, $posttotid_press);
$blogposts = array_values($blogposts);
$posttotal = count($blogposts);
//i<=2 means displays last 2 posts
//display latest 2 posts...
for ( $i=1; $i<=2; $i++ )
{
?>
<div class="blog">
<h2><?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getPostDate(); ?></h2>
<h1><?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getPostTitle(); ?></h1>
<div style="float:left; margin-top:15px; margin-bottom:25px;">
<?php
$featured_img = $this->getSkinUrl('images/pree_emty.png');
if($featuredImage = $col_posts->getItemById($blogposts[$posttotal-$i])->getFeaturedImage())
{
$featured_img = $featuredImage->getAvailableImage();
}
?>
<img style="float: left;" src="<?php echo $featured_img; ?>" width="204" height="204" alt="" />
<div style="float: left; width: 580px; padding: 10px;">
<p><?php echo substr(strip_tags($col_posts->getItemById($blogposts[$posttotal-$i])->getPostContent()), 0, 400); ?></p>
<p>
<a href="<?php echo $col_posts->getItemById($blogposts[$posttotal-$i])->getUrl(); ?>">
<img src="<?php echo $this->getSkinUrl('images/view_btn.jpg'); ?>" width="170" height="32" alt="" />
</a>
</p>
</div>
</div>
</div>
<?php
}
?>