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

Ross11mm on "Sort Posts by Views"

$
0
0

I am currently using WordPress Popular Posts which displays top posts by views in a widget. But I am trying to sort the posts on my homepage by the most views in a certain period, i.e. sort posts by the most views in the last week. I am unable to find a suitable plugin although it seems like a fairly simple task to perform but alas I'm unable to find out how to do this. I have a very basic knowledge of PHP and wordpress and am happy to edit code if somene can help me out. I'm currently developing my site locally and using a child theme.
Thanks,
Ross


jeesus on "Ability to pull database from backend"

$
0
0

Hi there

My friend has an issue with his service provider. The problem is that they are hosting a Wordpress account for him and are asking a lot of money for it. Too much in fact. So what they did was that they promised to tear down the website unless my friend pays, which is way too much (talking about hundreds of $). The friend cannot let that website go down, it's too vital for business.

Now I'm asking you: is there any way I could get the database through WP admin? They have disabled plugins section, so right now I can't find any way to reach my goal. I also don't have any FTP access to alter files. Ideas, guys?

Any help appreciated.

Liltiger on "Redirect Login for Non Admins to Profile"

$
0
0

Howdy,

I've tried to modify wp-login.php to redirect the login page to the profile if they're non admins. I'm halfway there. The code below redirects all users to the profile. Will someone tell me where I went wrong?

Thanks!

if ( isset( $_REQUEST['redirect_to'] ) ) {
		$redirect_to = $_REQUEST['redirect_to'];
		// Redirect to https if user wants ssl
		if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
			$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
	} else {
                <strong>if( current_user_can('administrator') ) {</strong>
		$redirect_to = admin_url();
                <strong>} else {
                $redirect_to = admin_url( 'profile.php' );
                }</strong>
	}

kuldeepofficial on "Need a Table Structured WP Theme"

$
0
0

Hello Guys.....Urgent Help needed!
I'm looking to provide ms office 2010 product key for my private membership members so for this i'm searching for a wp theme by which i can manage all product keys....

like it should automatically shows if keys are used!

Thanks!!

Gotzak on "Help with "is user logged in""

$
0
0

Hi there,
im trying to set up a forum with wordpress: http://www.die-dunkle-wache.de/forum (i never used Wordpress or css before)
I installed the "bbpress-login-register-links-on-forum-page" Plugin and tried to script it...i failed.
I want to hide the Plugin (Login,Register,forgotpsw-links)if a user is already logged in.
This is the default:

<?php
function bbpressLoginRegisterLinksOnForumPage()
{
	echo '<div class="bbpressloginlinks" style="float:right;padding-right:20px;">';
	$login_url = site_url( 'wp-login.php' );
	echo "<a href='$login_url'>".' Log In '.'</a> ';

	$register_url = site_url( 'wp-login.php?action=register' );
	echo " <a href='$register_url' style='margin-left:20px;'>".' Register '.'</a> ';

	$lost_password_url = site_url( 'wp-login.php?action=lostpassword' );
	echo " <a href='$lost_password_url' style='margin-left:20px;'>".' Lost Password '.'</a> ';
	echo '</div>'; // class of "bbpressloginlinks"
}

	add_action('bbp_template_after_forums_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_pagination_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_after_single_forum','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_forums_loop','bbpressLoginRegisterLinksOnForumPage');

and this is what i did (http://codex.wordpress.org/Function_Reference/is_user_logged_in):

<?php
 if ( is_user_logged_in() )
{
}
else
{
function bbpressLoginRegisterLinksOnForumPage()
{
	echo '<div class="bbpressloginlinks" style="float:right;padding-right:20px;">';
	$login_url = site_url( 'wp-login.php' );
	echo "<a href='$login_url'>".' Log In '.'</a> ';

	$register_url = site_url( 'wp-login.php?action=register' );
	echo " <a href='$register_url' style='margin-left:20px;'>".' Register '.'</a> ';

	$lost_password_url = site_url( 'wp-login.php?action=lostpassword' );
	echo " <a href='$lost_password_url' style='margin-left:20px;'>".' Lost Password '.'</a> ';
	echo '</div>'; // class of "bbpressloginlinks"
}

	add_action('bbp_template_after_forums_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_pagination_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_after_single_forum','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_forums_loop','bbpressLoginRegisterLinksOnForumPage');
}
?>

but when i use it the forumpage gets empty

Hope you can help me
Best Regards,
Gotzak

sugartoys on "Get Specific Taxonomy Count"

$
0
0

Hi guys. first, i lookup just in case to avoid asking but no luck.

Im trying to get a specific taxonomy count.

Im doing a dashboard that count taxonomies and custom post types. I manage to use wp_count_posts and wp_count_terms to get the counts and it works just fine. But now i want to get the number of specific term. I manage to query the whole list but now i just need to display a specific one.

Im using $sgr_cpt = wp_count_terms('trabajo'); then echo it to get my count. Do i need to add something to the parm of the class? this is where i got stuck.

thnx in advance. :)

BrittCoxon on "filtering terms from get_terms"

$
0
0

I have two custom taxonomies, one called painting_tag and the other galleries. I'm working on an archive page for galleries.

At the top of the page I've got a list of tags from painting_tag I'm using to filter these posts further. Right now the list shows all painting_tag tags used by my posts. I'd like it to show only tags that are used by the posts in the archive.

I know in $args there are exclude and include but I've failed to get them to do the job.

$terms = get_terms('painting_tag', $args);
        $count = count($terms);
        if ( $count > 0 ){
            foreach ( $terms as $term ) {
                echo "<li><a href='javascript:void(0)' data-filter='.".$term->slug."'>" . $term->name . "</a></li>\n";

The Three on "Alert users when a post is publish?!"

$
0
0

Hello there!

It is possible to alert users when a post is publish?
Not by email but in website with a simple alert() function?


jawanet on "Please Fix breadcrumb Not show on page and category"

$
0
0

Hello all master wordpress.

I had a little problem with the coding breadcrumb.
breadcrumb does not appear on the title page view:
http://www.jawanet.com/hosting/

In category also does not appear:
http://www.jawanet.com/category/wordpress-tutorial/

And in the category of post types breadcrumb links nor can:
http://www.jawanet.com/review/brand/lenovo/

Please help the master of all that which I purpose to work.
This my code:

function jseo_breadcrumb() {

	/* === OPTIONS === */
	$text['category'] = 'Archive by Category "%s"'; // text for a category page
	$text['search']   = 'Search Result For <h1>%s</h1>'; // text for a search results page
	$text['tag']      = 'Posts Tagged "%s"'; // text for a tag page
	$text['author']   = 'Articles Posted by %s'; // text for an author page
	$text['404']      = 'Error 404'; // text for the 404 page

	$show_current   = 1; // 1 - show current post/page/category title in breadcrumbs, 0 - don't show
	$show_title     = 1; // 1 - show the title for the links, 0 - don't show
	$delimiter      = '<span style="padding: 0px 1px 0px 1px;"> » </span>'; // delimiter between crumbs
	$before         = '<span class="current">'; // tag before the current crumb
	$after          = '</span>'; // tag after the current crumb

	/* === END OF OPTIONS === */

	if (!is_home() && !is_front_page()) {
    global $post;
    $homelink = home_url() ;

/******  Please do not edit :P ********/

	$div_before   = '<div class="breadcrumb-list" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">';
	$div_after    = '</div>';
	$span_before_microdata = '<span itemprop="title" class="current">';
	$link_before  = '<span class="current">';
	$link_after   = '</span>';
	$link_attr    = ' itemprop="url"';
	$link         = $link_before . '<a' . $link_attr . ' href="%1$s">%2$s</a>' . $link_after;
	$parent_id    = $parent_id_2 = $post->post_parent;

    echo '<div class="breadcrumb"><div class="breadcrumb-wrap">';
        echo '<div class="breadcrumb-list"><a href="';
        echo home_url();
        echo '"><span>';
        echo 'Home</span>';
        echo '</a></div> ' . $delimiter . ' ';

    if (is_category() || is_single() || get_post_type() != 'post' ) {
        $post_type = get_post_type_object(get_post_type());
        $separator = ' ';
        $output = '';

    if($categories){
         $thisCat = get_category(get_query_var('cat'), false);
    if ($thisCat->parent != 0)
	    echo get_category_parents($thisCat->parent, TRUE, ' ' . $delimiter . ' ');
        echo $before . '' . single_cat_title('', false) . '' . $after;

    }
    if (is_single() && !is_attachment() ) {
		if ( get_post_type() != 'post' ) {

		$post_type = get_post_type_object(get_post_type());
		$slug = $post_type->rewrite;
		echo '<div class="breadcrumb-list" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
			  <a itemprop="url" href="' . $homeLink . '/' . $slug['slug'] . '/"><span itemprop="title">' . $post_type->labels->name . '
			  </span></a></div> ' . $delimiter . '';

	  if ($terms = get_the_terms( $post->ID , 'brand' )){
      foreach ( $terms as $term ) {
      $term_link = get_term_link( $term, 'brand' );
        echo '<div class="breadcrumb-list" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
				      <a itemprop="url" href="'.$term_link.'">
					  <span itemprop="title">' . $term->name . '</span></a></div> ' . $delimiter . ' ';
       }
    }
		echo $before . get_the_title() . $after;

	} else {
        $cat = get_the_category(); $cat = $cat[0];
        $cats = get_category_parents($cat, TRUE, $delimiter);

	  if ($show_current == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats);

			$cats = str_replace('<a', $div_before . '<a' . $link_attr, $cats);
            $cats = str_replace('</a>', '</a>' . $div_after, $cats);

			$cats = str_replace('<a', $span_before_microdata . '<a', $cats);
			$cats = str_replace('</a>', $span_after . '</a>', $cats);

      if ($show_title == 0) $cats = preg_replace('/ title="(.*?)"/', '', $cats);
        echo $cats;
      if ($show_current == 1) echo $before . get_the_title() . $after;
		}

	}
		else
		if ( !is_single() && !is_page() && get_post_type() !== 'post' && !is_search() && !is_paged()) {
			$post_type = get_post_type_object(get_post_type());
		if (!empty($post)) {
			echo $before . $post_type->labels->singular_name . $after;
			}
		else
			echo $before . __('No Results', 'comicpress') . $after;
       }
    }
    elseif ( is_attachment() ) {
      $parent = get_post($post->post_parent);
      $cat = get_the_category($parent->ID); $cat = $cat[0];
      echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
      echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>';
      if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;

    }
	elseif ( is_page() && !$post->post_parent ) {
      if ($showCurrent == 1) echo $before . get_the_title() . $after;

    } elseif ( is_page() && $post->post_parent ) {
      $parent_id  = $post->post_parent;
      $breadcrumbs = array();
      while ($parent_id) {
        $page = get_page($parent_id);
        $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
        $parent_id  = $page->post_parent;
      }
      $breadcrumbs = array_reverse($breadcrumbs);
      for ($i = 0; $i < count($breadcrumbs); $i++) {
        echo $breadcrumbs[$i];
        if ($i != count($breadcrumbs)-1) echo ' ' . $delimiter . ' ';
      }
      if ($showCurrent == 1) echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;

    }

        else
		 if ( is_search() ) {
			echo $before . sprintf($text['search'], get_search_query()) . $after;
	}
		if ( get_query_var('paged') ) {
			if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
			echo __('Page', 'jseo') . ' ' . get_query_var('paged');
			if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
		}
		echo '</div></div>';
        }
    }

All appear custom Post

Tanks in advance

partoo on "How to auto-update WP core via custom server"

$
0
0

Google services blocked in China,that means Chinese user can't to use Google fonts.
When new version published,I change code to the other cdn and then upload the file one by one,it's hellish!
So,Can I make a custom core version and change update url to my service?

dandan357 on "Website Hacked and unable to open"

$
0
0

Hello, I was chatting with someone at my hosting company concerning my website been closed, I was told my website was hacked and certain files I needed to take off, which i have now deleted and also change my FTP password; which I have changed now. I was informed that all services for my domain are now enabled, but my site came up blank. I was told to enable PHP errors for my domain. I have done this and got a message on my site page:

Warning: require(/customers/0/3/9/epnikcare.co.uk/httpd.www/wp-includes/compat.php): failed to open stream: No such file or directory in /customers/0/3/9/epnikcare.co.uk/httpd.www/wp-settings.php on line 71 Fatal error: require(): Failed opening required '/customers/0/3/9/epnikcare.co.uk/httpd.www/wp-includes/compat.php' (include_path='.:/usr/share/php') in /customers/0/3/9/epnikcare.co.uk/httpd.www/wp-settings.php on line 71

I contacted my hosting company and I was told that the error could be due to infected files that I have deleted from wordpress and that I may contact the wordpress support forum about this.

Please I would appreciate any help that I can get to resolve this thank you.

gonliSs on "Permissions problem after adding parameter to redirection"

$
0
0

Hello,

I have simple form which calls my function:

<form class="pure-form pure-form-stacked" method="POST" action="<?php echo admin_url( 'admin.php' ); ?>" >
    <fieldset>

        <input type="hidden" name="action" value="update_game_list" />
        <button type="submit" class="pure-button pure-button-primary">Update</button>
    </fieldset>
</form>

and then in function my code does simple thing and then I'd like to return one variable to this page, so I have such code at the end of function update_game_list:

wp_redirect( $_SERVER['HTTP_REFERER'] . "?inserted_games=" . $inserted_games );
		exit();

but it returns error:

You do not have sufficient permissions to access this page.

but when I delete parameter everything is ok:

wp_redirect( $_SERVER['HTTP_REFERER'] );
		exit();

Why? How to repair it?

yosmc on "Hook needed on media upload page"

$
0
0

Hi everyone,

I am desperately looking for a hook I can use on /wp-admin/media-new.php after images are uploaded. I've tried add_attachment, but that does nothing on this page.

Right now, I am using admin_init instead and then I check $pagenow to see if I'm on the right page. My problem, however, is that my plugin needs the ID of the file that was just uploaded, and I just can't figure out how.

Any help greatly appreciated!

MursaleenSiddique on "how to check SoakSoak.ru affected site ?"

$
0
0

Hello everyone recently i heard that there is a new malware name SoakSoak.ru.. and thousands of wordpress site are affected by this.
so how can i checked if my site? http://www.ultraupdates.com is affected or not ?

atom8bit on "Updating RSS Feed"

$
0
0

This one should be pretty simple, I just want to add some extra lines to an RSS feed for a specific category
(specifically, the website hosts podcasting, so I need extra lines in both the header and the post areas of the rss2 feed.)

I saw in the codex this:

remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'acme_product_feed_rss2', 10, 1 );

function acme_product_feed_rss2( $for_comments ) {
    $rss_template = get_template_directory() . '/feeds/feed-acme_product-rss2.php';
    if( get_query_var( 'post_type' ) == 'acme_product' and file_exists( $rss_template ) )
        load_template( $rss_template );
    else
        do_feed_rss2( $for_comments ); // Call default function
}

Will this work? Where do I put it, in the theme's functions file?

Please don't recommend a plugin. I'd rather edit the theme directly if possible.


keith_e on "Aligning Buttons On Website"

$
0
0

Hi

I want to align two buttons I've put on a website with the left hand side of the header image. The way I've got it at the moment it using an offset in px has the buttons in different positions depending on the resolution of the screen the website is being viewed on.

Help please?

Details:
Site : homebeachmediademo5.com
Code in header.php:

<div class="lang-english">
    <a href="<?php echo 'http://www.cjljewellery.com.au'.$_SERVER['REQUEST_URI']; ?>" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/ausflag-50x25.png" title="English"></a>
    </div>
    <div class="lang-french">
    <a href="<?php echo 'http://www.homebeachmediademo5.com'.$_SERVER['REQUEST_URI']; ?>" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/frenchflag-50x25.png" title="Francais"></a>
    </div>

style.css entry:

.lang-english {
float:left;
top:265px;
margin-left:110px;
z-index: 3;
}

.lang-french {
float:left;
top:265px;
margin-left:10px;
z-index: 3;
}

Shmoo on "wp_print_media_templates function problem"

$
0
0

Since WordPress 4.1.0 the wp_print_media_templates() function doesn't work anymore if you first remove the action and later add the same function again, only with a different name. ( for testing )

remove_action( 'admin_footer', 'wp_print_media_templates' );
add_action( 'admin_footer', 'my_print_media_templates' );

function my_print_media_templates() {

...... 100% the same code as original for testing .....

}

Looks like it breaks the Javascripts or something because there is no drop down functionality inside the backend, also the screen options panel at the top doesn't work anymore.

pipo5000 on "Simplifying add_submenu_page()?"

$
0
0

Hello everyone,

Recently I have started developing my own plugins. I am trying to make a plugin that I can use easily to add features to my website.

In order to allow myself to easily add dashboard pages/submenu items I made a simplified function of add_submenu_page(). I am just not sure if I am doing this the correct way.

add_action( 'admin_menu', 'tm_plugin_dashboard_menu');
function tm_plugin_dashboard_menu(){

	function tm_plugin_dashboard_submenu( $title, $function ){
		$slug = "terpstra-media-$function";						// Decapitalise page slug by using $function variable.
		$callback = "tm_plugin_dashboard_settings_$function";	// Create callback function name
		// Submenu page defaults
		add_submenu_page( 'terpstra-media', $title, $title, 'manage_options', $slug, $callback );
	}

	/*
	 Create submenu pages trough this function:
	 tm_plugin_dashboard_submenu( $title, $function );
	*/
	tm_plugin_dashboard_submenu( __('Widgets', 'tm-plugin'), 'widgets' );
	tm_plugin_dashboard_submenu( __('Shortcodes', 'tm-plugin'), 'shortcodes' );

	// add plugin main page after submenu pages to prevent wordpress from creating top-level duplicate
	add_menu_page(
			__('Terpstra Media Plugin', 'tm-plugin'),
			__('Terpstra Media Plugin', 'tm-plugin'),
			'manage_options',
			'terpstra-media',
			'tm_plugin_dashboard_settings_main',
			'dashicons-sos',
			'2.1' );
}

I hope you guys can help me accomplish this. As soon as I know how to do this the correct way I can finish my plugin in no-time.

lynnmosher on "Site hacked/ads added to related posts"

$
0
0

I was hacked. Now, I have ads intermingled with my own posts thumbnails in related posts at end of each post. I've searched for a way to delete them but cannot find anything that works. I'm using Genesis and Child's Theme.

bernex on "Upload exist plugin and reinstall"

$
0
0

I'm wanna upload and rewrite plugin. But WP do not allow this. How to enable install and upload for exist plugins.

Thanks!

Viewing all 8245 articles
Browse latest View live




Latest Images