- This topic has 12 replies, 2 voices, and was last updated 10 years, 8 months ago by Sakin.
-
AuthorPosts
-
March 2, 2014 at 10:05 am #20863tkabeMember
Checking out Catch Everest Pro – did not see a feature related to swipe for mobile devices to allow user to zoom in. Current Catch Everest does not support this feature. Suggestions or thoughts?
March 2, 2014 at 7:40 pm #20866SakinKeymaster@tkabe: Yes it’s not allowed. If you need that feature then you need to build child theme and create functions.php file in your child theme and add the following code:
<?php // Removing the Default Action Hook function unhook_catcheverest_functions() { remove_action( 'wp_head', 'catcheverest_responsive', 5 ); } add_action( 'init', 'unhook_catcheverest_functions' ); //Responsive Meta in Child Theme function catcheverest_child_responsive() { // Getting data from Theme Options global $catcheverest_options_settings; $options = $catcheverest_options_settings; $disable_responsive = $options[ 'disable_responsive' ]; if ( $disable_responsive == "0" ) { echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'; } } add_action( 'wp_head', 'catcheverest_child_responsive', 5 );
March 3, 2014 at 1:50 am #20881tkabeMemberI get this error
>>Parse error: syntax error, unexpected ‘<‘ in /home/content/44/10651744/html/wp-content/themes/catch-everest-child/functions.php on line 98<<after adding the mobile swipe and the remove “Permalink To” php code you provided to functions.php code posted below.
child theme functions.php
<?php/** CPA Customization
* Unassociated – discover what this is related to
*
* @uses catcheverest_header action to add it in the header
*/
function register_my_menus() {
register_nav_menus(
array(
‘primary’ => __( ‘Profile Menu’ ),
‘sidebar-menu’ => __( ‘Sidebar Menu’ )
)
);
}
add_action( ‘init’, ‘register_my_menus’ );function image_tag($html, $id, $alt, $title) {
return preg_replace(array(
‘/’.str_replace(‘//’,’//’,get_bloginfo(‘url’)).’/i’,
‘/s+width=”d+”/i’,
‘/s+height=”d+”/i’,
‘/alt=””/i’
),
array(
”,
”,
”,
‘alt=”‘ . $title . ‘”‘
),
$html);
}
add_filter(‘get_image_tag’, ‘image_tag’, 0, 4);/** CPA Customization
* Shows Featured Post Slider
*
* @uses catcheverest_header action to add it in the header
*/
function catcheverest_post_sliders() {
//delete_transient( ‘catcheverest_post_sliders’ );global $post, $catcheverest_options_settings;
$options = $catcheverest_options_settings;if( ( !$catcheverest_post_sliders = get_transient( ‘catcheverest_post_sliders’ ) ) && !empty( $options[ ‘featured_slider’ ] ) ) {
echo ‘<!– refreshing cache –>’;$catcheverest_post_sliders = ‘
<div id=”main-slider” class=”container”>
<section class=”featured-slider”>’;
$get_featured_posts = new WP_Query( array(
‘posts_per_page’ => $options[ ‘slider_qty’ ],
‘post__in’ => $options[ ‘featured_slider’ ],
‘orderby’ => ‘post__in’,
‘ignore_sticky_posts’ => 1 // ignore sticky posts
));
$i=0; while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++;
$title_attribute = apply_filters( ‘the_title’, get_the_title( $post->ID ) );
$excerpt = get_the_excerpt();
if ( $i == 1 ) { $classes = “post hentry slides displayblock”; } else { $classes = “post hentry slides displaynone”; }
$catcheverest_post_sliders .= ‘
<article class=”‘.$classes.'”>
<figure class=”slider-image”>
‘. get_the_post_thumbnail( $post->ID, ‘slider’, array( ‘title’ => esc_attr( $title_attribute ), ‘alt’ => esc_attr( $title_attribute ), ‘class’ => ‘pngfix’ ) ).’
</figure>
<div class=”entry-container”>
<header class=”entry-header”>
<h1 class=”entry-title”>
‘.the_title( ‘<span>’,'</span>’, false ).’
</h1>
</header>’;
if( $excerpt !=”) {
$catcheverest_post_sliders .= ‘<div class=”entry-content”>’. $excerpt.'</div>’;
}
$catcheverest_post_sliders .= ‘
</div>
</article><!– .slides –>’;
endwhile; wp_reset_query();
$catcheverest_post_sliders .= ‘
</section>
<div id=”slider-nav”>
<
>
</div>
<div id=”controllers”></div>
</div><!– #main-slider –>’;set_transient( ‘catcheverest_post_sliders’, $catcheverest_post_sliders, 86940 );
}
echo $catcheverest_post_sliders;
}/** CPA Customization
* Allow Mobile swip/gestures
*
* @uses catcheverest_header action to add it in the header
*/
function unhook_catcheverest_functions() {
remove_action( ‘wp_head’, ‘catcheverest_responsive’, 5 );
}
add_action( ‘init’, ‘unhook_catcheverest_functions’ );//Responsive Meta in Child Theme
function catcheverest_child_responsive() {
// Getting data from Theme Options
global $catcheverest_options_settings;
$options = $catcheverest_options_settings;
$disable_responsive = $options[ ‘disable_responsive’ ];if ( $disable_responsive == “0” ) {
echo ‘<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>’;
}
}
add_action( ‘wp_head’, ‘catcheverest_child_responsive’, 5 );?>
March 3, 2014 at 1:53 am #20882SakinKeymaster@tkabe: Your code looks messy. So, can you post your code in http://gist.github.com/ and send me the core link url. Then I will be able to check in.
March 3, 2014 at 2:08 am #20884tkabeMemberI searched the file using notepad ++ and the WP editor and could not find an error in line 98.
Adding the PHP code for the remove “Permalink To” at first allowed the server refresh as you described using theme options however now this fails and causes the error described.
I had to upload the functions.php from a backup to get the site back up.
March 3, 2014 at 2:11 am #20885SakinKeymaster@tkabe: I cannot check in your child theme functions.php file form here. That is why you need paste our code in github and send me the link. Then I will check in the code and send you the feedback. I think you are not using the code with
' and "
March 3, 2014 at 2:29 am #20889tkabeMemberI am working on sharing the file in GitHub shortly.
March 3, 2014 at 2:59 am #20892tkabeMemberSakin – the file cpa_child_functions.php a copy of the functions.php file may be found here – https://github.com/tkabe/GitHub_code_help
Thank you for your review.
March 3, 2014 at 8:51 am #20902SakinKeymaster@tkabe: There is no such issue in the code that you have posted in GitHub, I have cleaned the code and proposed the changes in GitHub as your code didn’t have write permission. The only thing I am confused is why the file name is
cpa_child_functions.php
it should be just ‘functions.php`March 4, 2014 at 12:03 am #20938tkabeMemberSorry Sakin, I am not clear where you put the changes. I looked in my GitHub and at the file itself and did not see your post.
I understand the correct system file name is on “functions”.php I created this name simply to keep this file from conflicting with any saved original or child theme file on your end or my end.
March 4, 2014 at 12:10 am #20939SakinKeymaster@tkabe: When I add in the code in my child them functions.php file. It is working fine. Maybe you can upload your complete child theme in dropbox or somewhere I can download it. Maybe you have problem with other files.
March 4, 2014 at 1:09 am #20948tkabeMemberI uploaded the new modified code you provided in the GitHub Branch and got a different error code –
Parse error: syntax error, unexpected T_FUNCTION in /home/content/44/10651744/html/wp-content/themes/catch-everest-child/functions.php on line 8I appreciate your generous assistance, however after carefully rebuilding the functions.php file both the mobile gestures and removal of “Permalink To” are working. I would consider this issue closed. Thank you very much for providing excellent support!
Here are my steps I performed to fix the file.
1. Restored functions.php from a recent backup.
2. Tested this file – working ok.
3. This time I added the mobile gestures code to functions.php first before any other new code. I used the editor in WP and updated the file – successfully.
4. Refreshed the server – deactivated webclips in theme options.
5. tested gestures on mobile successfully.
6. Added the code to remove “Permalink To” into the functions.php file using WP editor and updated the file – successfully.
7. Refreshed the server – activated webclips in theme options.
8. Test in homepage slider – successfully.March 4, 2014 at 1:14 am #20949 -
AuthorPosts
- The topic ‘Mobile Device Swipe’ is closed to new replies.