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

halben on "custom login/logout item to menu"

$
0
0

Wondering if anyone can help me on this:

I have the following:

/*
 * -------------------------------
 * custom_login_out_item_to_menu()
 * -------------------------------
 */

add_filter('wp_nav_menu_items', 'custom_login_out_item_to_menu', 50, 2);
function custom_login_out_item_to_menu($items, $args) {
	if (is_admin() || $args -> theme_location != 'top')
		return $items;

	$redirect = ( is_home()) ? false : get_permalink();

	if (is_user_logged_in())
		$link = '<a href="' . wp_logout_url($redirect) . '" title="' . __('Logout') . '">' . __('Logout') . '</a>';
	else
		$link = '<a href="' . wp_login_url($redirect) . '" title="' . __('Login') . '">' . __('Login') . '</a>';

	return $items .= '<li id="log-in-out-link" class="menu-item menu-type-link">' . $link . '</li>';
}

I'm trying to add a custom login / logout link through my child theme functions.php. When I paste this into my functions.php, it's suppose to generate a login/logout link in my theme location : Top Navigation.

The problem is, it's now showing anything. Can anyone please help fix this?

Thanks,
Hal


ajberasategui on "Get Cropped Thumbnail"

$
0
0

Hi!

I'm writing a plugin for Wordpress. I need to retrieve cropped version of post thumbnail but I can't.

Here's what I'm doing:

I open the image in the builtin image editor, I crop it obtaining a 203 x 300px version. I crop it and save it (only thumbnail).

Then in my plugin I'm trying to obtain it with:
get_the_post_thumbnail( $post->ID, 'thumbnail' );
which gives me a 80 x 120px version (instead of 203 x 300)!

I've also tried the following way:

<?php
$image = wp_get_attachment_image_src( $attachId, 'thumbnail' );
?>
<img src="<?php echo $image[0]; ?>" alt="<?php echo $imgAlt; ?>" />

and I'm obtaining a 91x120px version!

Any help will be very much appreciated!

Regards
Agus

TrishaM on "Modify size of Excerpt MetaBox"

$
0
0

I need to know what I can add to my functions.php (or another method?) to make the metabox for entering the Excerpt (on the Post/Page Add/Edit screen) larger as a default. We use that box for a specific purpose but as it only shows three lines - and the entered text is more than three lines - it means scrolling that we'd like to eliminate.

How can I make the size of that box be something like 10 lines?

Thanks for any advice!

Clement78 on "get_post_meta with html language tags"

$
0
0

Hello,

I have a plugin that adds a link functionality using custom posts.
Each link field (except for the title) seems to be a custom field / meta.
As I'm using qTranslate, I'm willing to use HTML languages tags as <!--:en--> into the text fields (like the link description) and then choose the right translation to display.
This would look like this :
<!--:en-->Hello<!--:--><!--:fr-->Bonjour<!--:-->

The problem is that every time that I return the description content (for example), these tags disappear ! The result is the same whether I use get_post_meta() or call $wpdb with get_var() on the meta.
Has anybody an idea of how I could get the raw html content without the tags being stripped ?

Thanks all

laurafulmer on "Virus at the top of Blog. HELP :("

$
0
0

I went to check on my blog the other day + noticed I now have an advertisement/virus? for Cialis/Viagra at the top of my page. How in the world do I get rid of this? I've tried so many different methods + nothing seems to get rid of it. :( Any help is greatly appreciated!

L

Shapeshifter 3 on "3-Column Bootstrap Scaffolding"

$
0
0

Can anybody tell me the correct way to implement 3-columns into individual Static Pages or Posts using Bootstrap version 2.3.2. I've gone to the Bootstrap website; tried to follow their instructions; but here's what I come up with:

http://toolbox-4-websites.com/design/responsive/

Code shows up in the display, instead of creating 3-columns for content.

Franz92 on "the_content vs the_excerpt: Theme, obey my will!"

$
0
0

Stop! Okay, carry on reading, but pssshhht.

Thank you for lending me your attention. The website uses a heavily modified version of the theme "News-Leak". (I should fork it somewhen, but I have no clue how. However, that is another topic.)

The theme displays posts on the front page differently. The first post gets an full-size image + excerpt (controlled via the more-tag). The other posts just show an excerpt of 20 words. I want the first post to show this behaviour, too.

This is the code of the first post:

<div id="post_holder">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="post_dets">
<div class="post_author"><?php if(get_the_author_meta('userimg') != ""): ?>
<img class="Autorenbild" src="<?php the_author_meta( 'userimg' ); ?>" width="40" height="40" />
<?php else: ?>
<img src="<?php echo get_template_directory_uri(); ?>/images/no_user_img.jpg" alt="<?php the_title(); ?>" width="40" height="40" />
<?php endif; ?>
<span>Geschrieben von:</span><span class="post_details"><?php the_author_posts_link(); ?></span></div>
<div class="post_time"><span>Geschrieben am:</span><span class="post_details"><a href="<?php echo get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')); ?>"><?php the_time('F j, Y') ?>
 </a></span></div>

<?php if (!empty($post->post_password)) {?><?php }else { ?><?php if ( comments_open() ) : ?><div id="comments_option">Meinungen<br  /><a href="<?php the_permalink() ?>/#leave-comment">Kommentiere</a><div class="comments-counter"><?php comments_popup_link('0', '1', '%', '', ''); ?></div></div><?php ; else : ?><div id="comments_option">Die Kommentare sind geschlossen.</div><?php endif; ?><?php } ?></div>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>><?php the_content('Lesen Sie mehr...'); ?>

<?php wp_link_pages( array( 'before' => '<p class="page-link">' . __( 'Pages:' ), 'after' => '</p>' ) ); ?>

<div class="post_category"><span>In der Kategorie:</span> <?php the_category(', ' ) ?><?php the_tags('<br /><span>Tags:</span>',' , ','<br />'); ?>    </div>

</div>

</div>

How do I modify it in a way, that it does as I pledge?

Comment: Simply switching "the_content" to the "the_excerpt" doesn't work. The picture then gets stripped from the front-page.

Dave Navarro, Jr. on "Simple Pie"

$
0
0

Is it possible to use Simple Pie directly instead of the fetch_feed() API call?

I need to control the cache time of individual RSS feeds and fetch_feed() uses a global cache time for all feeds.


gicts on "Banner hack help"

$
0
0

I have several WP sites that appear to have been hacked. At the top of the page is a banner with a bunch of spam.

Here is the view source:

<body class="home blog gecko et_includes_sidebar"> <div style ="border:4 px solid black ; font-weight : 400; background-color:DarkSeaGreen;" >annoying spam and spam links</div>

I've browsed the files without success, but since it is on multiple sites, I'm concerned of a larger issue. Has anyone experienced this issue before? Here is one of my sites for reference- bowmanfield.com. I've run malware and virus scans without success.

Thanks for any help or guidance!

jase2903 on "Hidden links - please help with removal"

$
0
0

Hi guys,
I have directorypress theme installed and have been building my site for a little while now. The other day i checked the source code and come across this at the top of the source:

<div style='text-indent:-8989em'>
[ Spammy links removed ]

I have posted in the directorypress community forum but after trying many of their suggestions it still remains. I have no idea how to get rid of it.

Is anyone here familiar with this and know how to remove it?

Thanks in advance

tayssir.ch on "tutorial needed"

$
0
0

hello dear,
am using custom post type, custom taxonomies, and 2 meta value : carprice , carmilieage
after searching, i need to sort result by price / milieage
but i wish if can i have drop down, with string
&orderby=carprice&order=asc
can anyone send me tutorial link or code ? thanks

wen.wainwright on "Split "twentytwelve_entry_meta""

$
0
0

I am by no means a programmer but I've looked this over and I understand the connections in this situation (entry_meta) and the relationship between the coding in the functions.php and the content.php for the entry_meta. I want to move the author and date to under the post title and leave the categories and tags below the post. I've already moved the leave reply to the bottom of the post and all of the entry_meta to the top of the post.

So my actual question is: Can I take half of the entry_meta (like the author and date) and give it a new name like post_meta or post_info (or something) and rearrange it in the functions.php and the content.php? The part I'm unsure about is if in the hierarchy of wordpress files is entry_meta set in stone? Or is it possible to take part and rename it and then call it from the content.php?

If my words are incorrect in programming language/circles I apologize! I do know there are names you should use because it impacts things elsewhere. And I do have a child theme :)

inayatseliya on "wp-admin access denied"

$
0
0

I can't access my wordpress dashboard only thing while i get while accessing to my site hotelapexbharuch.in/wp-admin is 'Access denied."

normal site is working perfectly fine there's no change to content or as if its been hacked or something like that.

I doubt something is wrong with plugin or something
I am using following plugin for security and cache
Better WP Securrity
W3 Total Cache

after doing some searching i found out my wp-config file is missing.

philperrin on "Custom image upload coding for functions.php"

$
0
0

I'm incorporating some custom fields on functions.php to be used for extending profile fields. I'm having difficulty implementing an upload feature so that users can upload a profile image. Any advice? THANKS!

philliproman on "302 Redirect Spam"

$
0
0

My blog is hosted on BlueHost and on WP version 3.6. I just tried to access my website via my iPhone and I was redirected to a spam site. WHen I try to access my site via a computer, the redirection does not occur. I used a redirect checker and it verified the site is using a 302 redirect: 302 to http://jpartner.org

After searching .htaccess files in my file manager, the following files came up. Are all of there necessary or are some causing the problem? I have not set up any plugins to manage redirects so if the .htaccess is not standard then I am assuming it is causing the problem.

Which files should I keep?

Thank you for your help.

/public_html/.htaccess
/public_html/wp-content/.htaccess
/public_html/wp-content/plugins/.htaccess
/public_html/wp-content/uploads/.htaccess
/public_html/wp-content/uploads/2012/.htaccess
/public_html/wp-content/uploads/2012/10/.htaccess
/public_html/wp-content/uploads/2012/09/.htaccess
/public_html/wp-content/themes/.htaccess
/public_html/wp-includes/theme-compat/.htaccess
/public_html/wp-includes/js/swfupload/.htaccess
/public_html/wp-admin/.htaccess
/public_html/wp-admin/user/.htaccess
/public_html/wp-admin/network/.htaccess
/public_html/wp-admin/images/.htaccess
/public_html/wp-admin/js/.htaccess
/public_html/wp-admin/css/.htaccess


WebTechGlobal on "Sectioning Plugin Using Class Problem"

$
0
0

My plugin is going to be pretty big and it is going to have a lot of class. What I'm trying to do is create a parent class for a specific group of class. It works to a certain extent but not good enough really. What I have right now would be handy for very specific procedures that involve creating a string result using functions in multiple class. Possibly handy but I was hoping PHP would allow better than this and can't see that it does. But I ain't an expert.

I'm wondering if anyone can help get around my problem or confirm that what I'm trying to do is impossible, please.

The problem is the use of _toString() and not being able to either remove it or use it practically in very large class. When I say large I simply mean a few functions more than this example so not really large right, just normal.

Abstract class WPeCUS_ExtensionBridge
{
    // array containing all the extended classes
    private $_exts = array();
    public $_this;

    function __construct(){$_this = $this;}

    public function addExt($object)
    {
        $this->_exts[]=$object;
    }

    public function __get($varname)
    {
        foreach($this->_exts as $ext)
        {
            if(property_exists($ext,$varname))
            return $ext->$varname;
        }
    }

    public function __call($method,$args)
    {
        foreach($this->_exts as $ext)
        {
            if(method_exists($ext,$method))
            return call_user_method_array($method,$ext,$args);
        }
        throw new Exception("This Method {$method} doesn't exists, not good really. Please report this problem, thank you.");
    }
}  

class WPECUS_WP_to_phpBB_bridge {
    public function doesthisworkwell2(){
        return 'Sending some data from Wordpress to the phpBB database, we will want a return on it, boolean, string whatever.';
    }
} 

class WPECUS_userssection_to_phpBB_bridge {
    public function doesthisworkwell1(){
        return 'The user section of our pluginn and phpBB itself is pretty big so we are using this class to deal with user data specifically, how about returning arrays?';
    }
}

/**
* Main bridge class
* Offers integration functionality across WP e-Customer sections and 3rd party software. Currently integrated...
*
* Each section has its own class which extends this class
*/
class WPeCus_bridges_main extends WPeCUS_ExtensionBridge {

    function __construct()
    {
        parent::addExt(new WPECUS_WP_to_phpBB_bridge());
        parent::addExt(new WPECUS_userssection_to_phpBB_bridge());
    }

    public function __toString()
    {
        return $this->doesthisworkwell1().', from: '.$this->doesthisworkwell2();
    }

}

$o = new WPeCus_bridges_main();
$o->doesthisworkwell1();

echo $o;

$o->doesthisworkwell2();
echo $o;

So that is pretty much it but just to be clear. Here is the specific issue that makes me wonder if this approach is going to work.

return $this->doesthisworkwell1().', from: '.$this->doesthisworkwell2();

Can this line be replaced with anything that would allow a return from any function rather than stating them? This line pretty much renders all the code above as a very specific procedure rather than being a general one. It's almost useless right now really and my knowledge of PHP class ends here. I know all about using "extends" and I know multiple class can be stacked to get the effect I'm looking for. Problem there is if one class is not loaded it breaks the chain and that is likely in our plugin as we plan for it to be split into addons.

Any ideas, providing your making sense of this right!?

phishyman2 on "Add category label to Recent Post widget"

$
0
0

SSIA

I want each "recent post" to also show the category. I don't care anything about limiting the categories that are shown, I just want to show which category the post is listed under.

Can anyone help? Thanks

Leo Blanchette on "after_setup_theme not running after theme setup"

$
0
0

In a plugin I've done an add_action( 'after_setup_theme' , 'some_funct' ); and then the plugin calls a function named in the theme's functions.php file.

It should work! It came in after "theme setup"! Yet its saying undefined function!!! I'm living in the twighlight zone.

Is there any instances or reasons after_setup_theme would disobey the idea of loading after theme setup?

Tyler on "Image appear on hover"

$
0
0

Hi
I want to build an image hover feature into my site, I have a list of text links and I would like an image to appear in a fixed position on the page. Each link will show a different image in the same place on the page.

Any pointers on how to do this or to plugins/tutorials would be very welcome.

danEdmonds on "Query Multiple Taxonomies in Taxonomy Archive Template"

$
0
0

Hello,

I've created a custom post type, "Available Candidates", and I've created two custom taxonomies for this post type, "Industry" and "State". I have a custom page listing each State term and each State term links to it's corresponding taxonomy archive page, listing the "Available Candidates" posts within this taxonomy.

This works great, but now I'd like to loop through each Industry taxonomy listing each "Available Candidate" post under each Industry within each State. The loop is built and works great but as of now every "Available Candidates" post is listed here. I need to query these posts by the current State taxonomy archive.

Pennsylvania Archive Page:

  • Industry
    • Candidate 1
    • Candidate 2
  • Industry
    • Candidate 1
    • Candidate 2
  • Industry
    • Candidate 1
    • Candidate 2

Maryland Archive Page:

  • Industry
    • Candidate 1
    • Candidate 2
  • Industry
    • Candidate 1
    • Candidate 2
  • Industry
    • Candidate 1
    • Candidate 2

Here's my taxonomy page code.

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

	<h1><?php echo $term->name; ?></h1>

	<?php
	$tax = 'industry';
	$tax_terms = get_terms($tax);

	if ($tax_terms) {

		foreach ($tax_terms  as $tax_term) {

			$args=array(
			"$tax" => $tax_term->slug,
		      	'post_status' => 'publish',
		      	'posts_per_page' => -1,
		      	'caller_get_posts'=> 1
		    );

			$my_query = null;
			$my_query = new WP_Query($args);

			if( $my_query->have_posts() ) {
			?>

				<div>

					<h2><?php echo($tax_term->name); ?></h2>

					<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

						<!-- post-<?php the_ID(); ?> -->
						<article id="post-<?php the_ID(); ?>">

							<header>

								<h3><?php the_title(); ?></h3>

						    </header>

					    	<div>

								<?php the_content(); ?>

							</div>

						</article>
						<!-- /post-<?php the_ID(); ?> -->

					<?php endwhile; ?>

				</div>

			<?php
			} // end if

			wp_reset_query();

		} // end for each

	} // end if
	?>
Viewing all 8245 articles
Browse latest View live




Latest Images