Where to find text in wordpress? - php

I am trying to make changes to a site that is in Wordpress and the widget that I thing have the info I want to change a blank. I found the footer.php code in the editor put need help where the copyright text is. Where the code says ($data['copyright_text']), where do I find the copyright text?
<?php
global $data;
?>
<?php
if ( empty( $data['footer_show'] ) || (!empty( $data['footer_show'] ) && $data['footer_show'] == 'yes') ) { ?>
<footer id="footer">
<div class="container">
<?php
if ( !empty ( $data['footer_row1_widget_positions'] ) ) {
if ( (!empty ( $data['footer_row1_show'] ) && $data['footer_row1_show'] == 'yes' ) || empty ( $data['footer_row1_show'] ) ) {
echo '<div class="row">';
$number_of_columns = key( json_decode ( stripslashes ( $data['footer_row1_widget_positions'] ) ) );
$columns_array = json_decode ( stripslashes ( $data['footer_row1_widget_positions'] ),true );
for ($i = 1; $i <= $number_of_columns; $i++) {
echo '<div class="span'.$columns_array[$number_of_columns][0][$i-1].'">';
if ( !dynamic_sidebar('Footer row 1 - widget '.$i.'') ) : endif;
echo '</div>';
}
echo '</div><!-- end row -->';
}
}
if ( !empty ( $data['footer_row2_widget_positions'] ) ) {
if ( (!empty ( $data['footer_row2_show'] ) && $data['footer_row2_show'] == 'yes' ) || empty ( $data['footer_row2_show'] ) ) {
echo '<div class="row">';
$number_of_columns = key( json_decode ( stripslashes ( $data['footer_row2_widget_positions'] ) ) );
$columns_array = json_decode ( stripslashes ( $data['footer_row2_widget_positions'] ),true );
for ($i = 1; $i <= $number_of_columns; $i++) {
echo '<div class="span'.$columns_array[$number_of_columns][0][$i-1].'">';
if ( !dynamic_sidebar('Footer row 2 - widget '.$i.'') ) : endif;
echo '</div>';
}
echo '</div><!-- end row -->';
}
}
?>
<div class="row">
<div class="span12">
<div class="bottom fixclear">
<?php
if ( isset( $data['footer_social_icons'] ) && is_array( $data['footer_social_icons'] ) && !empty ( $data['footer_social_icons'][0]['footer_social_icon'] ) ) {
$icon_class = '';
if( $data['footer_which_icons_set'] == 'colored' ) {
$icon_class = 'colored';
}
echo '<ul class="social-icons '.$icon_class.' fixclear">';
echo '<li class="title">'.__('GET SOCIAL', THEMENAME ).'</li>'; // Translate
foreach ( $data['footer_social_icons'] as $key=>$icon ){
$link = '';
$target = '';
if ( isset ( $icon['footer_social_link'] ) && is_array ( $icon['footer_social_link'] )) {
$link = $icon['footer_social_link']['url'];
$target = 'target="'.$icon['footer_social_link']['target'].'"';
}
echo '<li class="'.$icon['footer_social_icon'].'"><a href="" '.$target.'>'.$icon['footer_social_title'].'</a></li>';
}
echo '</ul>';
}
?>
<?php if( $data['copyright_text'] || $data['footer_logo'] ) { ?>
<div class="copyright">
<?php
if( $data['footer_logo'] ) {
echo '<img src="'.$data['footer_logo'].'" alt="" />';
}
if( $data['copyright_text'] ) {
echo '<p>'.stripslashes($data['copyright_text']).'</p>';
}
?>
</div><!-- end copyright -->
<?php } ?>
</div><!-- end bottom -->
</div>
</div><!-- end row -->
</div>
</footer>
<?php } ?>
</div><!-- end page_wrapper -->
<?php echo __('TOP', THEMENAME ); ?> <?php // Translate ?>
<?php wp_footer(); ?>
</body>
</html>

If you just want to see what the current copyright text is, you can stick echo $data['copyright_text']; anywhere after declaring global $data;.
To delete it, you can do $data['copyright_text'] = null; or $data['copyright_text'] = '';

Be careful of changing your theme like this. If you have a theme that has a commercial License, you may get into trouble for removing the Licencees copyright and trademark.
If you've created the theme yourself however, then it should be placed in the footer file in a place that is appropriate to the design of the theme.

Related

Change the profile cover image dynamically

does someone know how to change an image header dynamically depends by specific categories,
ex: image1 for red category, image2 for blue category, image3 for green category?
Im using ultimate member plugin but don't well php coding
I have found the original code
function um_profile_header_cover_area( $args ) {
global $ultimatemember;
if ( $args['cover_enabled'] == 1 ) {
$default_cover = um_get_option('default_cover');
$overlay = '<span class="um-cover-overlay">
<span class="um-cover-overlay-s">
<ins>
<i class="um-faicon-picture-o"></i>
<span class="um-cover-overlay-t">'.__('Change your cover photo', 'ultimatemember').'</span>
</ins>
</span>
</span>';
?>
<div class="um-cover <?php if ( um_profile('cover_photo') || ( $default_cover && $default_cover['url'] ) ) echo 'has-cover'; ?>" data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
<?php do_action('um_cover_area_content', um_profile_id() ); ?>
<?php
if ( $ultimatemember->fields->editing ) {
$items = array(
''.__('Change cover photo', 'ultimatemember').'',
''.__('Remove', 'ultimatemember').'',
''.__('Cancel', 'ultimatemember').'',
);
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', $items );
}
?>
<?php $ultimatemember->fields->add_hidden_field( 'cover_photo' ); ?>
<?php echo $overlay; ?>
<div class="um-cover-e">
<?php if ( um_profile('cover_photo') ) { ?>
<?php
if( $ultimatemember->mobile->isMobile() ) {
if ( $ultimatemember->mobile->isTablet() ) {
echo um_user('cover_photo', 1000);
echo um_user('cover_photo', 300);
}
} else {
echo um_user('cover_photo', 1000);
}
?>
<?php } elseif ( $default_cover && $default_cover['url'] ) {
$default_cover = $default_cover['url'];
echo '<img src="'. $default_cover . '" alt="" />';
} else {
if ( !isset( $ultimatemember->user->cannot_edit ) ) { ?>
<span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="<?php _e('Upload a cover photo', 'ultimatemember'); ?>"></i></span>
<?php }
} ?>
</div></div>
<?php
}}
Thanks in advance

Output left or right when a condition is met within a php foreach loop

I have a foreach loop with 2 options.
"Image and text" OR "plain text"
When the user selects "Image and text" the sections need to alternate image left and image right. I can achieve this using css :nth-of-type. But this only works if the image and text blocks are consecutive.
What I need to do is check which type of section the user has selected, if it's "image and text" add a class to define the layout and do the opposite for the next section that is also "image and text"
confused? me too... Heres some html to show how the sections should flow for a better understanding:
<div class="image-text left"></div>
<div class="text"></div>
<div class="image-text right"></div>
This is my current PHP loop:
<?php
global $prefix;
$career_profiles = rwmb_meta("career_profiles");
foreach ( $career_profiles as $profile ) :
$career_section = isset( $profile["{$prefix}career_section"] ) ? $profile["{$prefix}career_section"] : '';
/**
* Careers section can be image and text OR text
* #var [type]
*/
$career_section_class = ( $career_section == 'image_text' ) ? 'image-text' : 'text';
$career_image = isset( $profile["{$prefix}career_image"] ) ? $profile["{$prefix}career_image"] : array();
foreach ( $career_image as $ci ) :
$photo = RWMB_Image_Field::file_info( $ci, array( 'size' => 'careers_photo' ) );
endforeach;
$career_name = isset( $profile["{$prefix}career_name"] ) ? $profile["{$prefix}career_name"] : '';
$career_name_id = clean($career_name);
$career_introduction = isset( $profile["{$prefix}career_introduction"] ) ? $profile["{$prefix}career_introduction"] : '';
?>
<div class="<?php echo $career_section_class; ?> clearfix">
<?php if ($photo) : ?>
<div class="image b-lazy" data-src="<?php echo $photo['url']; ?>"></div><!-- /.image -->
<?php endif; ?>
<div class="profile clearfix">
<div class="profile-wrapper font22 clearfix">
<?php if ($career_name) : ?>
<h2 class="font34"><?php echo $career_name; ?></h2>
<?php endif; ?>
<?php echo wpautop($career_introduction); ?>
</div><!-- /.profile-wrapper -->
</div><!-- /.profile -->
</div><!-- /.career-profiles_profile -->
<?php
endforeach; // foreach ( $career_profiles as $section ) :
?>
One thought I had was to check if the current loops $career_section_class == 'image-text' then add the left or right class, but how would I check in which order to add that positioning class?
Thanks to #Barmar and #04FS for their help in solving this.
For anybody else here is the solution:
$align = "";
foreach ( $career_profiles as $profile ) :
$career_section = isset( $profile["{$prefix}career_section"] ) ? $profile["{$prefix}career_section"] : '';
$career_section_class = ( $career_section == 'image_text' ) ? 'image-text' : 'text';
/**
* Alternate the class if the section == image_text
*/
if ($career_section_class == 'image_text') {
$align = $align == "left" ? "right" : "left";
}
endforeach; // foreach ( $career_profiles as $section ) :

custom loop ad in wordpress

I am trying to show google ads in my website. I would like insert one at the top of the loop. 1st one and now more. It echo ad front every post, but I would like just show it once before the first one.
This is the code what I am using.
<div class="search-results">
<div class="row">
<?php
$counter_max = 4;
$column_size = 'col-sm-6 col-md-3';
if( $ads_search_layout == 'style-left' ){
$counter_max = 3;
$column_size = 'col-sm-6 col-md-4';
}
if( $view == 'list' ){
$counter_max = 2;
$column_size = 'col-md-6';
if( $ads_search_layout == 'style-left' ){
$counter_max = 1;
$column_size = 'col-md-12';
}
}
$counter = 0;
if( $ads->have_posts() ) {
while( $ads->have_posts() ){
$ads->the_post();
if( $counter == $counter_max ){
$counter = 0;
echo '</div><div class="row">';
}
?>
<div class="<?php echo esc_attr( $column_size ); ?>">
<?php
if(($counter>1) && ($counter == 0)){
echo( classifieds_load_path( 'includes/adsence.php' ) );
}
if( $view == 'grid' ){
$image_size = 'classifieds-ad-box-bug';
include( classifieds_load_path( 'includes/ad-box.php' ) );
}
else{
$excerpt_max = 154;
include( classifieds_load_path( 'includes/ad-box-alt.php' ) );
}
$counter++;
?>
</div>
<?php
}
}
?>
</div>
</div>
<?php wp_reset_postdata(); ?>

Can I add an ID to the divs in this Wordpress query?

I'm using this PHP snippet to wrap every 12 Wordpress posts in a div.
<?php
$i = 1;
echo '<div class="row content-block">';
if ( $project->have_posts() ) :
while ( $project->have_posts() ) : $project->the_post();
get_template_part('project', 'content');
if($i % 12 == 0) {echo '</div><div class="row content-block">';}
$i++; endwhile; endif;
echo '</div>';
?>
Is there any way that I can apply unique ID's to the row content-block divs? for example block-1, block-2, etc/
Yes (edited):
<?php
$i = 1;
$id = 2;
echo '<div class="row content-block" id="block-1">';
if ( $project->have_posts() ) :
while ( $project->have_posts() ) : $project->the_post();
get_template_part('project', 'content');
if($i % 12 == 0) {echo '</div><div class="row content-block" id="block-' .$id .'">'; $id++;}
$i++; endwhile; endif;
echo '</div>';
?>

Wordpress Magnifying function using images from custom filed "et_gallery"

The goal effect is: When clicked on the magnifying icon, it uses the "Fancybox" plugin to display big size images (mutiple images separated by commas) in the custom filed "et_gallery".
Right now the magnifying isn't working at all.
http://heidixu.com/#!/?page_id=4
It was working fine once. And then I accidently replaced the final code with an earlier version. So the version I currently have is pretty close but something is not right or missing and I can't figure out what because I'm not an expert in php...
This is the page: http://heidixu.com/#!/?page_id=4 and every other pages with thumbnails work the same.
This is my current version of php code that was edited:
<?php
/*
Template Name: Portfolio Page
*/
?>
<?php
$et_ptemplate_settings = array();
$et_ptemplate_settings = maybe_unserialize( get_post_meta($post->ID,'et_ptemplate_settings',true) );
$fullwidth = true;
$et_ptemplate_showtitle = isset( $et_ptemplate_settings['et_ptemplate_showtitle'] ) ? (bool) $et_ptemplate_settings['et_ptemplate_showtitle'] : false;
$et_ptemplate_showdesc = isset( $et_ptemplate_settings['et_ptemplate_showdesc'] ) ? (bool) $et_ptemplate_settings['et_ptemplate_showdesc'] : false;
$et_ptemplate_detect_portrait = isset( $et_ptemplate_settings['et_ptemplate_detect_portrait'] ) ? (bool) $et_ptemplate_settings['et_ptemplate_detect_portrait'] : false;
$gallery_cats = isset( $et_ptemplate_settings['et_ptemplate_gallerycats'] ) ? (array) $et_ptemplate_settings['et_ptemplate_gallerycats'] : array();
$et_ptemplate_gallery_perpage = isset( $et_ptemplate_settings['et_ptemplate_gallery_perpage'] ) ? (int) $et_ptemplate_settings['et_ptemplate_gallery_perpage'] : 12;
$et_ptemplate_portfolio_size = isset( $et_ptemplate_settings['et_ptemplate_imagesize'] ) ? (int) $et_ptemplate_settings['et_ptemplate_imagesize'] : 2;
$et_ptemplate_portfolio_class = '';
if ( $et_ptemplate_portfolio_size == 1 ) $et_ptemplate_portfolio_class = ' et_portfolio_small';
if ( $et_ptemplate_portfolio_size == 3 ) $et_ptemplate_portfolio_class = ' et_portfolio_large';
?>
<?php get_header(); ?>
<div class="single_container et_shadow">
<div class="single_content">
<div class="entry post clearfix">
<?php get_template_part('loop','page'); ?>
<div id="et_pt_portfolio_gallery" class="clearfix<?php echo $et_ptemplate_portfolio_class; ?>">
<?php $gallery_query = '';
$portfolio_count = 1;
$et_open_row = false;
if ( !empty($gallery_cats) ) $gallery_query = '&cat=' . implode(",", $gallery_cats);
else echo '<!-- gallery category is not selected -->'; ?>
<?php
$et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
?>
<?php query_posts("showposts=$et_ptemplate_gallery_perpage&paged=" . $et_paged . $gallery_query); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $width = 260;
$height = 170;
if ( $et_ptemplate_portfolio_size == 1 ) {
$width = 140;
$height = 94;
$et_portrait_height = 170;
}
if ( $et_ptemplate_portfolio_size == 2 ) $et_portrait_height = 315;
if ( $et_ptemplate_portfolio_size == 3 ) {
$width = 430;
$height = 283;
$et_portrait_height = 860;
}
$et_auto_image_detection = false;
if ( has_post_thumbnail( $post->ID ) && $et_ptemplate_detect_portrait ) {
$wordpress_thumbnail = get_post( get_post_thumbnail_id($post->ID) );
$wordpress_thumbnail_url = $wordpress_thumbnail->guid;
if ( et_is_portrait($wordpress_thumbnail_url) ) $height = $et_portrait_height;
}
$titletext = get_the_title();
$et_portfolio_title = get_post_meta($post->ID,'et_portfolio_title',true) ? get_post_meta($post->ID,'et_portfolio_title',true) : get_the_title();
$et_videolink = get_post_meta($post->ID,'et_videolink',true) ? get_post_meta($post->ID,'et_videolink',true) : '';
$thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,true,'et_portfolio');
$thumb = $thumbnail["thumb"];
if ( $et_ptemplate_detect_portrait && $thumbnail["use_timthumb"] && et_is_portrait($thumb) ) {
$height = $et_portrait_height;
} ?>
<?php if ( $portfolio_count == 1 || ( $et_ptemplate_portfolio_size == 2 && (!$fullwidth && ($portfolio_count+1) % 2 == 0) ) || ( $et_ptemplate_portfolio_size == 3 && (($portfolio_count+1) % 2 == 0) ) ) {
$et_open_row = true; ?>
<div class="et_pt_portfolio_row clearfix">
<?php } ?>
<div class="et_pt_portfolio_item">
<?php if ($et_ptemplate_showtitle) { ?>
<h2 class="et_pt_portfolio_title"><?php echo $et_portfolio_title; ?></h2>
<?php } ?>
<div class="et_pt_portfolio_entry<?php if ( $height == $et_portrait_height ) echo ' et_portrait_layout'; ?>">
<div class="et_pt_portfolio_image<?php if ($et_videolink <> '') echo ' et_video'; ?>">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>
<?php $gallery = explode(',', get_post_meta($post->ID, 'et_gallery', true));
foreach ($gallery as $item) { ?>
<a class="fancybox" href="<?php echo $item; ?>" style="display: none;" rel="gallery[<?php echo $post->ID; ?>]" title="<?php the_title(); ?>"></a>
<?php } ?>
<span class="et_pt_portfolio_overlay"></span>
<a class="et_portfolio_zoom_icon <?php if ($et_videolink <> '') echo 'et_video_lightbox'; else echo('fancybox'); ?>" title="<?php the_title(); ?>"<?php if ($et_videolink == '') echo ' rel="gallery[' . $post->ID . '"]'; ?> href="<?php if ($et_videolink <> '') echo $et_videolink; else echo($thumbnail['fullpath']); ?>"><?php esc_html_e('Zoom in','Sky'); ?></a>
<a class="et_portfolio_more_icon" href="<?php the_permalink(); ?>"><?php esc_html_e('Read more','Sky'); ?></a>
</div> <!-- end .et_pt_portfolio_image -->
</div> <!-- end .et_pt_portfolio_entry -->
<?php if ($et_ptemplate_showdesc) { ?>
<p><?php truncate_post(90); ?></p>
<?php } ?>
</div> <!-- end .et_pt_portfolio_item -->
<?php if ( ($et_ptemplate_portfolio_size == 2 && !$fullwidth && $portfolio_count % 2 == 0) || ( $et_ptemplate_portfolio_size == 3 && ($portfolio_count % 2 == 0) ) ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<?php if ( ($et_ptemplate_portfolio_size == 2 && $fullwidth && $portfolio_count % 3 == 0) || ($et_ptemplate_portfolio_size == 1 && !$fullwidth && $portfolio_count % 3 == 0) || ($et_ptemplate_portfolio_size == 1 && $fullwidth && $portfolio_count % 5 == 0) ) { ?>
</div> <!-- end .et_pt_portfolio_row -->
<div class="et_pt_portfolio_row clearfix">
<?php $et_open_row = true; ?>
<?php } ?>
<?php $portfolio_count++;
endwhile; ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<div class="page-nav clearfix">
<?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); }
else { ?>
<?php get_template_part('includes/navigation'); ?>
<?php } ?>
</div> <!-- end .entry -->
<?php else : ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
<?php get_template_part('includes/no-results'); ?>
<?php endif; wp_reset_query(); ?>
<?php if ( $et_open_row ) {
$et_open_row = false; ?>
</div> <!-- end .et_pt_portfolio_row -->
<?php } ?>
</div> <!-- end #et_pt_portfolio_gallery -->
</div> <!-- end .entry -->
</div> <!-- end .single_content -->
<div class="content-bottom"></div>
</div> <!-- end .single_container -->
<?php if (get_option('sky_show_pagescomments') == 'on') comments_template('', true); ?>
Could any php experts please take a look. Thank you so much.
-Heidi
So far, when you click on the magnifying icon, it produces this error:
Error: a is undefined
Source File: http://heidixu.com/wp-content/themes/Sky/epanel/page_templates/js/fancybox/jquery.fancybox-1.3.4.pack.js?ver=1.3.4
Line: 19
It looks like the link (the <a> tag) is not bound to fancybox regardless it has the specified class.
I want to believe that your generated code is not well formed; you have this html:
Zoom in
and wonder if this part specifically
... ]="" rel="gallery[ ....
...is creating the error. I cannot find what part of your php code generates those (misplaced?) brackets.

Categories