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

danny2104 on "Modification to admin bar SiteName doesn't change from one network site to other"

$
0
0

The wordpress admin bar has a 'Site Name' section, that when clicked takes you to the dashboard if you're on the front end, or vice versa. The sitename code for the admin bar can be found in wp-includes/admin-bar.php and i'd modified a section to have it display 'Visit $title Site' or 'Visit $title dashboard' instead of just '$title' in the sitename section of the admin bar. However, I wanted the new text to show a shortened form of $title instead. Say, 'Tech' for a network site named 'Technology', thus resulting in 'Visit Tech dashboard' or 'Visit tech site' on the admin bar. I had coded a simple if-loop that would assign a short title based on the blog id.

//To rename admin bar's main title
function rename_dashboard_sitename() {

global $current_site, $wp_admin_bar;

if ($current_site->id == 1) {
   $title=('Tech');}
elseif ($current_site->id == 2) {
   $title=('IT');}
elseif ($current_site->id == 1) {
   $title=('Info');}
elseif ($current_site->id == 7) {
   $title=('Ads');}
elseif ($current_site->id == 5) {
   $title=('Mkt');}

// Main Title
$wp_admin_bar->add_menu( array(
        'id'    => 'site-name',
        'title' => is_admin() ? ('Visit '.$title.' Site') : ( 'Visit '.$title.' Dashboard' ),
    'href'  => is_admin() ? home_url( '/' ) : admin_url(),
    ) );

}
add_filter('wp_before_admin_bar_render', 'rename_dashboard_sitename');

However, while the code works to the effect that the text changes to 'Visit XXXX dashboard', it stays constant for all the network sites after that. the $title variable does not change to a new value in each new network site as it is supposed to by checking the site ID. Is there something wrong in the loop? Is there any reason the $title variable does not change from site to site? Is it not being called repeatedly? I have noticed that generally, only the last $title is used for all sites, so perhaps it's skipping all the other options and fixating on only the last one? I'm fairly new to PHP, so I apologize if the error is an obvious one.


bradical911 on "Query posts sort by title and a meta key"

$
0
0

Hi,

Im trying to get my loop to sort alphabetically by title (the easy) bit then use the meta_key as a secondary value to sort as many titles are the same word. Ive tried to use the order by to set this but i dont think it works correctly.

$posts = query_posts($query_string . '&meta_key=Variety&orderby=meta_value, title&order=ASC&posts_per_page=20');

So the result shouldn't be

Cat - Red
Cat - Apple

instead

Cat - Apple
Cat - Red

omarcktell on "Location of Post Title"

$
0
0

So, we've got a temporary work around solution but it's not ideal.

If you go to: http://mr-ewokone.com/category/street/

Each thumbnail has a caption, the caption is actually the title of the post. Since I'm not the original developer, I cannot figure out where to edit the post title location.

All new post titles go above the image. All old posts go below.

The work around for now is to not use a post title and just place the name in the body of the post.

My question is, where would I edit the title location and how can I get it to appear under the image?

Thanks in advance.

rdcravens on "Main Menu -> Dynamic Select Box -> Need Ideas"

$
0
0

OK, so I have what seems to be a unique issue until I ask it and then find the list of answers I could not find for a week :-)

I have a select box on a page, lets call it the fruit selection box. This box updates the page (posts to self) to change the content based on the fruit selected. It also writes to the DB so that the site can remember what fruit you last looked at the next time you visit (so it passes variables - not just a page changer).

The list of fruits is created by the user and stored. The user can store up to 20 different fruits and each fruit possibility has its own column in the users table (for a reason) - so 20 potential columns with data coming in and one select box.

$change_list = htmlentities($_REQUEST['which_list']);

if ($change_list)
{
	$update = $wpdb->update('wp_users', array('active_list' => $change_list), array('ID' => $user_id), array('%f'));
	if ( is_wp_error( $update ) ) { echo 'Error Updating Active List'; }
}

if ($change_list)
{
	$which_list = $change_list;
} else {
	$which_list = $current_user->active_list;
}

// ------------ Create our drop down list selector
                      echo '<td style="width:80%; text-align:left;"><form name="whichlist" action="" method="POST"><select style="cursor:pointer; border:0px; outline:0px;" name="which_list" onChange="document.whichlist.submit()">';
$i = 1;
while ($i <= 20)
{
  $sel = '';
  $list_name = $current_user->{'fruit' . $i . '_name'};
  if ($which_list == $i){ $sel = 'selected'; }
  if ($list_name) { echo '<option value="' . $i . '" '. $sel .'>' . $list_name . '</option>'; }
  $i++;
}
echo '</select></form></td>';
// ------------ End Selector

All is fine and dandy to this point (works like a champ)... Now the tricky part (the part I can not solve)...

I would like the dynamically generated select list to be added to the navigation menu as a drop down select box like it would be seen on the page it is on now (drop down arrow, shows selected item on the list)...

I do not want to dynamically create a whole menu system, just add one top level menu item to the existing menu when the page opens (every time). I prefer to replace a menu placeholder so that I can move it around the menu as needed using the menu interface.

Is this possible? I am using the standard WP Menu system.

MotorRefin on "Duplicate"

$
0
0

am facing a major issue here. My Website seems to have duplicates on everything . eg :the pages on my menu, content on my pages. So each time i delete those duplicates and "save changes", nothing happens. Seems like there is a php file somewhere that i duplicating everything on my website, can you please help . heres the website : wwww.carfin.co.za

nlandstrom on "Mailform autoreply using wp_mail()"

$
0
0

Hi,

I am trying to get a mailform to send an autorepy when u have signed up for a course on the website.

http://pastebin.com/uMBWi625

I have searched for a soultion and found a possible solution but the base code for that solution has been removed so I can't get it to work.

Please advise!

Br, Niklas

ccprog on "Hook into wp_auth_check?"

$
0
0

I have a plugin settings page with multiple tabs that are loaded individually using Ajax requests. I find that after wp-auth-check forces a new login the nonce I use in these requests has expired - rightfully so.

But how do I get a new one? My idea would be to check heartbeat-tick.wp-auth-check data for being false and then enqueue my own heartbeat request. Is that a good idea or is there another way I am supposed to do it?

andreagenor on "QTranslate"

$
0
0

Hi,
I needed downgrade my WP 4.x to 3.8.1 because my qTranslate not work anymore, but now his not works and any change like broke line or something like this not recorded by de WP.
Sorry my bad English!


misharnet on "Theme Check problem"

$
0
0

I am creating my first WP Theme and I would like to upload it to wordpress.org. That's why I use, as recommended, Theme Check Plugin.

I resolved other issues, except these two.
1. REQUIRED: The <title> tags can only contain a call to wp_title(). Use the wp_title filter to modify the output

I understand that is related to title tag in header.php, am I wrong?
This is my header:

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->

<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title><?php wp_title( '|', true, 'right' ); ?></title>
	<meta http-equiv="cleartype" content="on">

	<!-- Responsive and mobile friendly stuff -->
	<meta name="HandheldFriendly" content="True">
	<meta name="MobileOptimized" content="320">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

	<?php wp_head(); ?>
</head>

What is wrong with it?

2. REQUIRED: screen_icon() found in the file class-tgm-plugin-activation.php. Deprecated since version 3.8.

Line 381: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );

Line 1584: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );

I understand that, but I don't know with what should I replace it?

I am really greatfull for your potential answers.

Mumsbis on "Creating a cookie"

$
0
0

Hi

I'm trying to create a cookie from information retrieved from a MySQL database.

Is there a simple way I can do this without getting the 'header already sent' error?

I've tried various plugins, but these don't seem to work. I'm not exactly a newbie but this seems to be outside my expertise.

Thanks

ViscoDesign on "Page title and thumbnail outside loop"

$
0
0

I'm trying to get the featured image and page title, for a specific array of IDs, from outside the loop. After tinkering a bit I've got as far as displaying the thumbnail, but I can't figure out how to grab the title too. At the moment the <h2> is just empty.

Here's my code:

<?php
	$page_id = array('17', '15', '19', '13'); //stores multiple page ID in an array
	//render image for each page using foreach conditional loop
	foreach($page_id as $id){
		if (has_post_thumbnail($id) ):
		$image = wp_get_attachment_image_src( get_post_thumbnail_id($id, 'thumbnail') );
		endif; ?>
		<div class="teaser-box">
			<h2><a href="<?php echo the_title( $id ); ?>"></a></h2>
			<?php echo "<img src='".$image[0]."'>"; ?>
		</div>
<?php } ?>

I tried searching, but I'm not that great with PHP so not even sure of what I'm searching for. Any help much appreciated! Thanks.

212admin on "Cannot Log into Admin Panel site hacked all-open-24"

PEBKACfr on "show an image when clicking on datepicker"

$
0
0

Hi,

I would like to show an image depending of a date choosen on datepicker.

First step i have added in functions.php of my theme:
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');

Then in page.php of my theme i have added the function below:

<script type="text/javascript">

jQuery(document).ready(function() {
jQuery('#MyDate').datepicker({
dateFormat : 'DD, d MM, yy',
numberOfMonths: 2,
inline: true,
minDate : -7,
maxDate : +30,
altField: '#MyDate_value',
onSelect: function(){
var day1 = $("#MyDate").datepicker('getDate').getDate();
var month1 = $("#MyDate").datepicker('getDate').getMonth() + 1;
var year1 = $("#MyDate").datepicker('getDate').getFullYear();
var fullDate = year1 + "-" + month1 + "-" + day1;
var str_sortie = "<img src=\"http://www.adress.com/" + fullDate +".jpg\">";
image_sortie.innerHTML = str_sortie;

}
});

});

</script>

3) In a wordpress page i have added

<!-- Datepicker -->

<div id="MyDate"></div>

<p>Image selected of the date <input type="text" id="MyDate_value" /></p>

<div id="image_sortie" style="text-align:center; margin-top:10px; margin-bottom:20px;"></div>

As a result on the page:
- i have the datepicker calendar for 2 months
- when i click on a date i have this date showed on the date picker box
- but i haven't got the image selected shown. My link is good because if i write <img src="http://www.adress.com/2014-10-01.jpg" /> for exemple for the picture of the 1st of octobre, i have got the picture showed.

I try to search but i don't find anything. If somebody understand in wich line the problem could be, could you exmplain me what to do ?

Thank you a lot and excuse me for my english.

muadem1 on "View pass when login WP in my LAN"

$
0
0

Hi all,

I have Big broplem with security. When i or hacker in lan in company use cain&abel

they can give my password. You can see it in my video! Can you fix this error for me!! I think it very and very important

I have my LINK : [ redacted ]
and pass: [ redacted, please do not post passwords in these forums ]

I test same error in wp 4.0

My site i view in my server!!

Thanks

crevinamd on "Excluding Category From Widget"

$
0
0

Hello, I'm looking for a solution to exclude categories from the categories sidebar widget. One that compliments this one:

https://wordpress.org/support/topic/excluding-category-from-widget

specifically, this part:

function exclude_widget_categories($args){
$exclude = "11,15,16"; // The IDs of the excluding categories
$args["exclude"] = $exclude;
return $args;
}
add_filter("widget_categories_args","exclude_widget_categories");
?>

That works great for a list, but we have to use the "dropdown" option on our widget because we have so many categories, and that code is not working with the dropdown. We're trying to "exclude" some of the categories that don't need to be displayed to the general public and in turn, simplify our list. Just not sure how to exclude categories from the dropdown.

Any thoughts would be appreciated. Thanks, kevin


janfeng on "About add custom fields to bbpress topic"

$
0
0

I want add custom fields to bbpress topic :

add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
function bbp_extra_fields() {
   $value = get_post_meta( bbp_get_topic_id(), 'bbp_extra_field1', true);
   echo '<label for="bbp_extra_field1">Extra Field 1</label><br>';
   echo "<input type='text' name='bbp_extra_field1' value='".$value."'>";
}

add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );

function bbp_save_extra_fields($topic_id=0) {
  if (isset($_POST) && $_POST['bbp_extra_field1']!='')
    update_post_meta( $topic_id, 'bbp_extra_field1', $_POST['bbp_extra_field1'] );
}

How to use this fields ?

If want to always display behind topics title, How ?!

For example :

Loop-topics
Post title
The browser title
……..

Maud Kon on "Get custom tables from database in wp-config.php"

$
0
0

I want to use another Wordpress installation that gets it's tables from my original Wordpress prefix. I installed both WP installations in the same database with another prefix. I use WP Event Manager and the original prefix is like this:

wp_em_events

I want the same plugin at my new installation to automatically get it's tables from the orginal one, like the following code already does for the users at my wp-config.php:

define('CUSTOM_USER_TABLE', 'wp_users');

Is there a rule I can use at my wp-config.php file like the one that gets the users? or is there another way to get the data from the orginal table to the new one?

manotomusic on "D'dos Protection"

Julie @Niackery on "Correct Way to Get Taxonomy Feed Link?"

$
0
0

I've got this on category archive pages and everything works well:

<?php
$category = get_category( get_query_var('cat') );
$current_category = single_cat_title("", false);

if ( ! empty( $category ) )

echo '<div class="tax-feed"><p style="text-align: right; padding-right: 2px;">Subscribe to the <strong>' . $current_category . '</strong> category: <a href="http://www.feedly.com/home#subscription/feed/' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to the ' . $current_category . ' category via Feedly" rel="nofollow">Via Feedly</a> | <a href="' . get_category_feed_link( $category->cat_ID ) . '" title="Subscribe to the RSS feed for the ' . $current_category . ' category" rel="nofollow">Via RSS</a></p></div>';
?>

Next I've got this on tag archive pages, but the Feedly link doesn't work:

<?php
$category = get_category( get_query_var('cat') );
$current_category = single_cat_title("", false);

if ( ! empty( $category ) )

echo '<div class="tax-feed"><p style="text-align: right; padding-right: 2px;">Subscribe to the <strong>' . $current_category . '</strong> topic: <a href="http://www.feedly.com/home#subscription/feed/' . get_tag_feed_link( $category->tag_ID ) . 'feed/" title="Subscribe to the ' . $current_category . ' topic via Feedly" rel="nofollow">Via Feedly</a> | <a href="' . get_tag_feed_link( $category->tag_ID ) . 'feed/" title="Subscribe to the RSS feed for the ' . $current_category . ' topic" rel="nofollow">Via RSS</a></p></div>';
?>

The Feedly link doesn't output this part of the URL (though the rest of the link is fine):

' . get_tag_feed_link( $category->tag_ID ) . '

I find it really strange that this code works for the tag RSS feed link but not the tag Feedly link. Any ideas why, and how I could fix it?

I'd also like to display the links on custom taxonomy archives and am wondering whether I'll need different code for those, too.

Thanks in advance for any help offered!

msens on "Footer not showing using DZS Timeline Slider Plugin"

Viewing all 8245 articles
Browse latest View live




Latest Images