I want to change the URL path when clicked on the logo. I tried changing the direction but it didn't work.
<?php
//set logo path
$logo_path = sq_option_url( 'logo' );
$logo_path = apply_filters( 'kleo_logo', $logo_path );
$social_icons = apply_filters( 'kleo_show_social_icons', sq_option( 'show_social_icons', 1 ) );
$top_bar = sq_option( 'show_top_bar', 1 );
$top_bar = apply_filters( 'kleo_show_top_bar', $top_bar );
$top_menu = wp_nav_menu( array(
'theme_location' => 'top',
'depth' => 2,
'container' => 'div',
'container_class' => 'top-menu col-sm-12 col-md-7 no-padd',
'menu_class' => '',
'fallback_cb' => '',
'walker' => new kleo_walker_nav_menu(),
'echo' => false
)
);
$primary_menu = wp_nav_menu( array(
'theme_location' => 'primary',
'depth' => 3,
'container' => 'div',
'container_class' => 'collapse navbar-collapse nav-collapse',
'menu_class' => 'nav navbar-nav',
//'fallback_cb' => 'kleo_walker_nav_menu::fallback',
'fallback_cb' => '',
'walker' => new kleo_walker_nav_menu(),
'echo' => false
)
);
?>
<div id="header" class="header-color">
<div class="navbar" role="navigation">
<?php if ($top_bar == 1) { //top bar enabled ?>
<!--Attributes-->
<!--class = social-header inverse-->
<div class="social-header header-color">
<div class="container">
<div class="top-bar">
<div id="top-social" class="col-sm-12 col-md-5 no-padd">
<?php echo kleo_get_social_profiles(); ?>
</div>
<?php
// Top menu
echo $top_menu;
?>
</div><!--end top-bar-->
</div>
</div>
<?php } //end top bar condition ?>
<?php
$header_style = sq_option( 'header_layout', 'normal' );
if ( $header_style == 'right_logo' ) {
$header_class = ' logo-to-right';
} elseif ( $header_style == 'center_logo' ) {
$header_class = ' header-centered';
} elseif ( $header_style == 'left_logo' ) {
$header_class = ' header-left';
} else {
$header_class = ' header-normal';
}
?>
<div class="kleo-main-header<?php echo $header_class;?>">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<div class="kleo-mobile-switch">
<?php
$mobile_menu_atts = 'class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"';
/* open the Side menu instead of the normal menu */
if ( sq_option( 'side_menu_mobile', 0 ) == 1 ) {
$mobile_menu_atts = 'class="navbar-toggle open-sidebar"';
}
?>
<button type="button" <?php echo $mobile_menu_atts;?>>
<span class="sr-only"><?php _e("Toggle navigation",'kleo_framework');?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="kleo-mobile-icons">
<?php
/** kleo_mobile_header_icons - action
* You can put here various icons using this action
*
* #hooked kleo_bp_mobile_notify - 9
* #hooked kleo_woo_mobile_icon - 10
*/
do_action( 'kleo_mobile_header_icons' );
?>
</div>
<strong class="logo">
<a href="http://hpkursen.se/hem/">
<?php if ($logo_path != '') { ?>
<img id="logo_img" title="<?php bloginfo('name'); ?>" src="<?php echo $logo_path; ?>" alt="<?php bloginfo('name'); ?>">
<?php } else { ?>
<?php bloginfo('name'); ?>
<?php } ?>
</a>
</strong>
</div>
<?php if ($header_style == 'left_logo') : ?>
<div class="header-banner">
<?php echo do_shortcode( sq_option( 'header_banner', '' ) );?>
</div>
<?php endif; ?>
<!-- Collect the nav links, forms, and other content for toggling -->
<?php
// Main menu
echo $primary_menu;
?>
</div><!--end container-->
</div>
</div>
</div>
The URL I want to redirect to instead of home is hpkursen.se/hem/
I tried to change the <a href="<?php echo home_url();?>"> to <a href="http://hpkursen.se/hem/"> but it still redirects to the Homepage when clicked. Does anyone know what the problem is?
You have the answer to your question:
Use <a href="<?php echo home_url();?>/hem/"> and it should work.
For more details/examples, please visit: https://codex.wordpress.org/Function_Reference/home_url
EDIT
I connected to your website and it seems that you're not editing the right file :) . You have this piece of code: $header_style = sq_option( 'header_layout', 'normal' );
Search for the file "header_layout". Search for this in your files:
<header>
<a class="logo" style="width:395px" href="http://hpkursen.se" rel="home">
<img alt="logo" src="http://hpkursen.se/wp-content/uploads/2015/01/logo_org_b.png">
</a>
</header>
Make sure you opened the right header file!
EDIT 2
There are two options:
1. Edit plugin
Go to: wp-content/plugins/maintenance/load/functions.php
On the line 155 you will find this:
function get_logo_box() {
$mt_options = mt_get_plugin_options(true);
$out_html = '';
if ( !empty($mt_options['logo']) ) {
$logo = wp_get_attachment_image_src( $mt_options['logo'], 'full');
$out_html = '<a class="logo" rel="home" href="'.esc_url(site_url('')) .'" style="width:'.$logo[1].'px">';
$out_html .= '<img src="'. esc_url($logo[0]) .'" alt="logo"/>';
$out_html .= '</a>';
} else {
$out_html = '<a class="logo istext" rel="home" href="'.esc_url(site_url('')) .'">';
$out_html .= '<h1 class="site-title">'. get_bloginfo( 'name' ) .'</h1>';
}
$out_html .= '</a>';
echo $out_html;
}
add_action ('logo_box', 'get_logo_box', 10);
Replace it with:
function get_logo_box() {
$mt_options = mt_get_plugin_options(true);
$out_html = '';
if ( !empty($mt_options['logo']) ) {
$logo = wp_get_attachment_image_src( $mt_options['logo'], 'full');
$out_html = '<a class="logo" rel="home" href="'.esc_url(site_url('/hem/')) .'" style="width:'.$logo[1].'px">';
$out_html .= '<img src="'. esc_url($logo[0]) .'" alt="logo"/>';
$out_html .= '</a>';
} else {
$out_html = '<a class="logo istext" rel="home" href="'.esc_url(site_url('/hem/')) .'">';
$out_html .= '<h1 class="site-title">'. get_bloginfo( 'name' ) .'</h1>';
}
$out_html .= '</a>';
echo $out_html;
}
add_action ('logo_box', 'get_logo_box', 10);
What I did was replacing this line: $out_html = '<a class="logo" rel="home" href="'.esc_url(site_url('/')) .'" style="width:'.$logo[1].'px">';
with this line: $out_html = '<a class="logo" rel="home" href="'.esc_url(site_url('/hem/')) .'" style="width:'.$logo[1].'px">';
2. Edit your theme's functions.php file
Go to wp-content/themes/your theme and open the file: functions.php
At the end of this file add:
function get_logo_box() {
$mt_options = mt_get_plugin_options(true);
$out_html = '';
if ( !empty($mt_options['logo']) ) {
$logo = wp_get_attachment_image_src( $mt_options['logo'], 'full');
$out_html = '<a class="logo" rel="home" href="'.esc_url(site_url('/hem/')) .'" style="width:'.$logo[1].'px">';
$out_html .= '<img src="'. esc_url($logo[0]) .'" alt="logo"/>';
$out_html .= '</a>';
} else {
$out_html = '<a class="logo istext" rel="home" href="'.esc_url(site_url('/hem/')) .'">';
$out_html .= '<h1 class="site-title">'. get_bloginfo( 'name' ) .'</h1>';
}
$out_html .= '</a>';
echo $out_html;
}
add_action ('logo_box', 'get_logo_box', 10);
In this way you will override the plugin's function.
Related
I'm currently working on a WirdPress Theme project using Bootstrap v5.0.2 and PHP 7.3.28.
I'm tryng to insert the Bootstrap Carousel Component in a custom widget but when I debug the code I recive this "Warning: Use of undefined constant active - assumed 'active' (this will throw an Error in a future version of PHP) in ... on line 70"
This is the line that give me the error:
echo ' class="';if ( $the_query->current_post == 0 ) : active ;endif; '"> ';
I try to change active in $active or 'active' but it doen't works.
Because I'm a newbie in PHP I don't understand what I'm doing wrong.
I hope someone can help me to solve this problem.
Thanks
This is the whole code:
<?php
// Register and load the widget
function tabulas_slider_widget() {
register_widget( 'Tabulas_Slider_Widget' );
}
add_action( 'widgets_init', 'tabulas_slider_widget' );
// Creating the widget
class Tabulas_Slider_Widget extends WP_Widget {
/**
* Register widget with WordPress.
*/
public function __construct() {
parent::__construct(
// Base ID of widget
'Tabulas_Slider_Widget',
// Widget name will appear in UI
esc_html__('Last Post Slider', 'tabulas'),
// Widget description
array( 'description' => esc_html__( 'Display the 3 last post published with featured image in the form of a Slider', 'tabulas'), )
);
}
/**
* Front-end display of widget.
*
* #see WP_Widget::widget()
*
* #param array $args Widget arguments.
* #param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
// WP_Query arguments
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
);
// The Query
$the_query = new WP_Query ( $args );
echo ' <div id="carouselExampleCaptions" ';
echo ' class="carousel slide" ';
echo ' data-bs-ride="carousel" ';
echo ' data-bs-interval="10000"> ';
echo ' <div class="carousel-indicators"> ';
if ( $the_query->have_posts() ) :
echo $args['before_widget'];
if ( $title ){
echo $args['before_title'] . $title . $args['after_title'];
}
echo ' <ol class="carousel-indicators"> ';
while ( $the_query->have_posts() ) : $the_query->the_post();
echo ' <li data-target="#ExampleCarouselID" ';
echo ' data-slide-to="';$the_query->current_post;'" ';
echo ' class="';if ( $the_query->current_post == 0 ) : active ;endif; '"> ';
echo ' </li> ';
endwhile;
echo ' </ol> ';
rewind_posts();
echo ' <button type="button" ';
echo ' data-bs-target="#carouselExampleCaptions" ';
echo ' data-bs-slide-to="0" ';
echo ' class="active" ';
echo ' aria-current="true" ';
echo ' aria-label="Slide 1">';
echo ' </button> ';
echo '<button type="button" ';
echo ' data-bs-target="#carouselExampleCaptions" ';
echo ' data-bs-slide-to="1" ';
echo ' aria-label="Slide 2">';
echo ' </button> ';
echo '<button type="button" ';
echo ' data-bs-target="#carouselExampleCaptions" ';
echo ' data-bs-slide-to="2" ';
echo ' aria-label="Slide 3">';
echo '</button>';
echo '</div>';
echo ' <div class="carousel-inner"> ';
while ( $the_query->have_posts() ) : $the_query->the_post();
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'full', true );
$thumbnail_meta = get_post_meta( $thumbnail_id, '_wp_attatchment_image_alt', true );
echo ' <div class="carousel-item ';
if ( $the_query->current_post == 0 ) : active ;endif; '"> ';
if ( has_post_thumbnail() ) {
echo '<a href="';the_permalink(); echo '">';
the_post_thumbnail('full');
echo '</a>';
}
echo '<div class="carousel-caption d-none d-md-block">';
echo '<h5>';
the_title();
echo '</h5>';
echo '</div>';
echo '</div>';
endwhile;
wp_reset_query();
echo '</div>';
echo '<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">';
echo '<span class="carousel-control-prev-icon" aria-hidden="true">';
echo '</span>';
echo' <span class="visually-hidden">';esc_html_e( 'Previous', 'tabulas' );
echo '</span>';
echo '</button>';
echo '<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">';
echo '<span class="carousel-control-next-icon" aria-hidden="true">';
echo '</span>';
echo '<span class="visually-hidden">';esc_html_e( 'Next', 'tabulas' );
echo '</span>';
echo '</button>';
echo '</div>';
echo $args['after_widget'];
wp_reset_postdata();
endif;
}
You must echo 'active' and end of line:
echo ' class="';if ( $the_query->current_post == 0 ) : echo 'active' ;endif; echo '"> ';
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 have a function I wrote in my functions.php page for a gallery to display on certain pages. It displays on custom templates, but now I need it to display on index.php Here is the code from my functions.php file:
function min_get_page_gallery( $echo = true) {
global $post;
$show_gallery = get_post_meta($post->ID, 'min_gallery-show', true);
if ( empty($show_gallery) ) {
return;
}
$gallery = get_post_meta($post->ID, 'min_image_advanced', false);
ob_start();
?>
<div class="gallery" id="gallery-<?php echo $post->ID; ?>">
<button class="gallery-move-left"><i class="fa fa-arrow-circle-left" aria-hidden="true"></i></button>
<div class="image_container clearfix">
<?php
$count = count($gallery);
$num = ceil($count / 3);
//$width_container = $num * 100;
//$width_row = 100 / $num;
//echo '<div class="gallery_inner" style="width:' . $width_container . '%;">';
echo '<div class="gallery_inner">';
for ( $i = 0; $i < $count; $i++) {
if ( $i % 3 == 0 ) {
//echo '<div class="row" style="width: ' . $width_row . '%;">';
echo '<div class="row'. (0 == $i ? ' active': ' inactive') .'">';
}
echo '<div class="col-sm-4 img_container' . (0 == $i ? ' active': ' inactive') . '">';
echo wp_get_attachment_image($gallery[$i], 'thumb-gallery');
echo '</div>';
if ( $i % 3 == 2 || ($i+1) == $count) {
echo '</div>';
}
}
echo '</div>';
?>
</div>
<button class="gallery-move-right"><i class="fa fa-arrow-circle-right" aria-hidden="true"></i></button>
</div>
<?php
$return = ob_get_contents();
ob_end_clean();
if ( $echo ) {
echo $return;
} else {
return $return;
}
}
That code works like a charm. Here is where I call it as min_get_page_gallery(); in awards.php where it works flawlessly:
<?php
/* Template Name: Awards Page Template */
get_header(); ?>
<div class="container" id="block-no-sidebar">
<h1><?php the_title(); ?></h1>
<div id="award-list">
<?php echo min_get_awards(); ?>
</div>
<div class="row">
<?php min_get_page_gallery(); ?>
</div>
<?php min_get_page_tabs(); ?>
</div>
<?php get_footer(); ?>
Now finally, I try to add the same function call of min_get_page_gallery(); in my index.php file like this:
<?php
// Silence is golden.
if ( ! defined ( 'ABSPATH' ) ) {
exit;
}
?>
<?php get_header(); ?>
<style class="take-to-head">
#block-main-content-with-sidebar { background: #ffffff; }
</style>
<div class="container" id="block-main-content-with-sidebar">
<div class="row">
<div class="col-sm-8">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
l('block-' . get_post_type());
endwhile; else:
l('block-none' );
endif;
?>
</div>
<div class="col-sm-4">
<?php l('block-sidebar'); ?>
</div>
</div>
<div class="row">
<?php min_get_page_gallery(); ?>
</div>
</div>
Is there something I'm missing??
Try to describe in more detail, what is wrong with your index.php? Is some output when load input.php, or blank page?
Is correctly defined ABSPATH? If not, your script exit on the beginning.
For more specific awareness of flow through the script, try to write there some echo
E.g.
<div class="row">
<?php echo "Before calling min_get_page_gallery()" ?>
<?php min_get_page_gallery(); ?>
<?php echo "After calling min_get_page_gallery()" ?>
</div>
Then look, if you can see the messages from echo before and after calling the desired function.
Ok, so I had to do some tweaking to get the meta to show in functions.php I added these lines:
$pagemain = is_page();
and then:
if ( $pagemain == is_page( 35393 ) ) {
$meta[] = array(
'id' => 'imageupload',
'post_types' => array( 'page'),
'context' => 'normal',
'priority' => 'high',
'title' => __( 'Image Gallery', 'min' ),
'fields' => array(
array(
'name' => __( 'Show', 'min' ),
'id' => "{$prefix}_gallery-show",
'desc' => __( '', 'meta-box' ),
'type' => 'checkbox',
'clone' => false,
),
array(
'id' => "{$prefix}_image_advanced",
'name' => __( 'Image Advanced', 'min' ),
'type' => 'image_advanced',
// Delete image from Media Library when remove it from post meta?
// Note: it might affect other posts if you use same image for multiple posts
'force_delete' => false,
// Maximum image uploads
//'max_file_uploads' => 2,
),
),
);
}
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.
Im working with a Wordpress theme.
The code I am having trouble with is relevant to a filter divided into "action" and "categories".
I would like to have 2 checkboxes checked by default (1 action & 1 category) and the rest blank.
I'm at a complete loss, any help would be sincerely appreciated.
here is the code:
<?php
$icons = array();
$taxonomy = 'property_action_category';
$tax_terms = get_terms($taxonomy);
$taxonomy_cat = 'property_category';
$categories = get_terms($taxonomy_cat);
// add only actions
foreach ($tax_terms as $tax_term) {
$icon_name = 'wp_estate_icon'.$tax_term->slug;
$icons[$tax_term->slug] = esc_html( get_option($icon_name) );
}
// add only categories
foreach ($categories as $categ) {
$icon_name = 'wp_estate_icon'.$categ->slug;
$icons[$categ->slug] = esc_html( get_option($icon_name) );
}
?>
<div class="gmap_wrapper <?php
if (!is_front_page()) {
print 'gmap_not_home" style="height:295px;"';
}else{
print'"';
}
?>>
<div class="gmap-next <?php if (is_front_page()) print 'is-front'; ?>" id="gmap-next" > </div>
<div class="gmap-prev <?php if (is_front_page()) print 'is-front'; ?>" id="gmap-prev" > </div>
<?php
$geo_status = esc_html ( get_option('wp_estate_geolocation','') );
$custom_image = esc_html( esc_html(get_post_meta($post->ID, 'page_custom_image', true)) );
$rev_slider = esc_html( esc_html(get_post_meta($post->ID, 'rev_slider', true)) );
if($geo_status=='yes' && $custom_image=='' && $rev_slider==''){
print' <div id="mobile-geolocation-button"></div>';
}
?>
<div id="googleMap" <?php
$home_small_map_status= esc_html ( get_option('wp_estate_home_small_map','') );
if (!is_front_page() || ( is_front_page() && $home_small_map_status=='yes' ) ) {
print 'style="height:295px;"';
}
?>
</div>
<div class="tooltip"> <?php _e('click to enable zoom','wpestate');?></div>
<div id="gmap-loading"><?php _e('Loading Maps','wpestate');?>
<span class="gmap-animation">
<img src="<?php print get_template_directory_uri();
?>
</span>
</div>
<?php
////////////////////////// enable /disable map filters
$show_filter_map_status = esc_html ( get_option('wp_estate_show_filter_map','') );
$home_small_map_status = esc_html ( get_option('wp_estate_home_small_map','') );
if($show_filter_map_status!='no'){
?>
<div class="gmap-menu-wrapper" >
<div class="gmap-menu" id="gmap-menu" <?php if (!is_front_page() || (is_front_page() && $home_small_map_status=='yes') ) print 'style="display:none;"'; ?> >
<div id="closefilters"></div>
<div class="action_filter" >
<?php
foreach ($tax_terms as $tax_term) {
print '<div class="checker"><input type="checkbox" checked="checked" name="filter_action[]" id="'.$tax_term->slug.'" class="'.$tax_term- >slug.'" value="'.$tax_term->name.'"/><label for="'.$tax_term->slug.'"><span></span>';
if( $icons[$tax_term->slug]!='' ){
print '<img src="'.$icons[$tax_term->slug].'" alt="'.$tax_term->name.'">' . $tax_term->name . '</label></div>';
}else{
print '<img src="'.get_template_directory_uri().'/css/css- images/'.$tax_term->slug.'icon.png" alt="'.$tax_term->name.'">' . $tax_term->name . '</label></div>';
}
}
?>
</div>
<div class="type-filters">
<?php
foreach ($categories as $categ) {
print '<div class="checker"><input type="checkbox" checked="checked" name="filter_type[]" id="'.$categ->slug.'" class="' . $categ->slug . '" value="' . $categ->name . '"/><label for="' . $categ->slug. '"><span></span>';
if( $icons[$categ->slug]!='' ){
print' <img src="'.$icons[$categ->slug].'" alt="'.$categ->slug.'">' . $categ->name . '</label></div>';
}else{
print' <img src="'.get_template_directory_uri().'/css/css-images/'.$categ->slug.'icon.png" alt="'.$categ->name.'">' . $categ->name . '</label></div>';
}
}
?>
</div>
</div>
</div>
<?php
}
?>
</div> `enter code here`
Thanks
Kyle