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

etai on "hey guys, help with my footer."

$
0
0

hey guys, I got a little problem with my wordpress site using "boemia" theme.

I have a widget area in the footer named "footer row" but when I put a widget in it it wont show in the site. never mind what widget is that its just wont show.

this is the registration code I have in the functions-theme.php file:

[ Code fixed, please use the code button for code blocks ]

//Footer with sidebar type widgets
    if( strstr( yit_get_option( 'footer-type' ), 'sidebar' ) ) {
        register_sidebar( yit_sidebar_args( "Footer Widgets Area", __( "The widget area used in Footer With Sidebar section", 'yit' ), 'widget span2', apply_filters( 'yit_footer_widget_area_wrap', 'h3' ) ) );
        register_sidebar( yit_sidebar_args( "Footer Sidebar", __( "The sidebar used in Footer With Sidebar section", 'yit' ), 'widget span6', apply_filters( 'yit_footer_widget_area_wrap', 'h3' ) ) );
    } else {
        //Footer sidebars
        for( $i = 1; $i <= yit_get_option( 'footer-rows', 0 ); $i++ ) {
            register_sidebar( yit_sidebar_args( "Footer Row $i", sprintf(  __( "The widget area #%d used in Footer section", 'yit' ), $i ), 'widget span' . ( 12 / yit_get_option( 'footer-columns' ) ), apply_filters( 'yit_footer_sidebar_' . $i . '_wrap', 'h3' ) ) );
        }
    }

any suggestions? please keep it easy and simple cause im not good at this + my english is not that good. :(


Mark Wilkinson on "Custom Capability for Custom Post Type"

$
0
0

I thought this would be easy and actually maybe it is, but after lots of searching it does seem rather complicated and difficult to find help and a solution. Here goes...

I have a site that am using a custom post type on. As normal I added the site without setting any capabilities etc. I have Authors on the site that I want to be able to edit their own pages and posts, which I have succeeded with. However I only want specific users to be able to do anything with my custom post type (see, edit, add and delete).

Therefore I thought a relatively good solution would be to make it so that only users with a certain capability get to see the custom post type. If they don't have that capability they don't even see the menu item in the WordPress admin. I could then assign users this capability as and when need with the User Role Editor plugin.

How would be best to go about this? Thanks in advance.

delacour.corp on "Lock change of administrator mail's address"

$
0
0

Hi,

For security reasons, I've found how to lock the accidental changes of website URL and home in the admin panel, by adding this to wp-config.php :
define('WP_HOME', 'http://mysite.com');
define('WP_SITEURL', 'http://mysite.com');

Now, I can't find how to lock admin mail address in th general options panel... Do you think it's possible to do so ?

All the best and many thanks !

RuudJoosten on "Loops and Multiple Terms in menu"

$
0
0

Hello, I have a question.

First off let me explain what im trying to do here.

In Wordpress i created custom posts(portfolio), with their own taxonomy and terms. I created a menu that displays items in their main categories and in subcategories, however this only works when these items have only 1 term selected. As soon as they have more than 1 term selected they will be displayed only under the first category (term). The menu has to show the items under every category it is included in.

In the code below i use a WP_Query to call onto all posts, and some of these posts have multiple terms.

I think part of the problem is with this: if($term_list[0] == $term->name){

It compares only the first term and therefore it will only use the first term and not any other ones, I however do not know how to solve this.

Any and all help would be greatly appriciated.

You can visit the site here: http://portfolio.custompost.nl/portfolio

echo        '<div id="javascript_wrapper">'; //Open Javascript wrapper
echo            '<div id="accordion">'; //Accordion wrapper for Categories

//Loops all posts, this is to display them all in the menu.
$menuLoop = new WP_Query
(
    array
    (
        'post_type' => 'portfolio',
        'posts_per_page' => -1,
        'order'=> 'ASC',
        'orderby'=> 'menu_order',
    )
);

foreach ($terms as $term)
{

    //ID of the term to get the children from, and variables for get_term.
    $term_id = $term->term_id;
    $taxonomy_name = $taxonomy[0];
    $termchildren = get_term_children( $term_id, $taxonomy_name );

    //Check if it's an error before continuing
    $term_link = get_term_link( $term, $taxonomy);
    if( is_wp_error( $term_link ) )
    continue;

    //If the parent term has children, place them in a submenu.
    if($termchildren){

        echo        '<h3><span class="accordionplus"></span><span class="accordionheaders">'.$term->name.'</span></h3>'; //Headers for Categories

        echo        '<div>'; //Content wrapper for Categories

        echo            '<ul>'; //List for Category //level 1 ul

        while ( $menuLoop->have_posts() ) : $menuLoop->the_post();
            $term_list = wp_get_post_terms($post->ID, $taxonomy, array("fields" => "names"));

            if($term_list[0] == $term->name){
                echo        '<li><a title="'.get_the_title().'" href="'.get_permalink().'">'.get_the_title().'</a></li>'; //List items for Category //level 1 li
            }

        endwhile; // end of the loop

        echo                '<div class="subaccordion">'; //Accordion wrapper for Subcategories

        foreach ( $termchildren as $child ) {

            $thechildterm = get_term_by( 'id', $child, $taxonomy_name );

            echo                '<li>'; //List item for Category //level 1 li

            echo                    '<h3><span class="accordionplus"></span><span class="accordionheaders">'.$thechildterm->name.'</span></h3>'; //Headers for Subcategories

            echo                    '<div>'; //Content wrapper for Subcategories

            echo                        '<ul>'; //List for Subcategory //level 2 ul

            while ( $menuLoop->have_posts() ) : $menuLoop->the_post();
                $term_list = wp_get_post_terms($post->ID, $taxonomy, array("fields" => "names"));

                if($term_list[0] == $thechildterm->name){
                    echo                    '<li><a title="'.get_the_title().'" href="'.get_permalink().'">'.get_the_title().'</a></li>'; //List items for Subcategory //level 2 li
                }

            endwhile; // end of the loop

            echo                        '</ul>'; //Close List for Subcategory //level 2 ul

            echo                    '</div>'; //Close content wrapper for Subcategories

            echo                '</li>'; //Close List item for Category //level 1 li
        }

        echo                '</div>'; //Close Accordion wrapper for Subcategories

        echo            '</ul>'; //Close List for Category //level 1 ul

        echo        '</div>'; //Close content wrapper for Categories

    }

    else {

        echo        '<h3><span class="accordionplus"></span><span class="accordionheaders">'.$term->name.'</span></h3>';

        echo        '<div>';

        echo        '<ul>';

        while ( $menuLoop->have_posts() ) : $menuLoop->the_post();
            $term_list = wp_get_post_terms($post->ID, $taxonomy, array("fields" => "names"));

            if($term_list[0] == $term->name){
                echo    '<li><a title="'.get_the_title().'" href="'.get_permalink().'">'.get_the_title().'</a></li>';
            }

        endwhile; // end of the loop

        echo        '</ul>';

        echo        '</div>';
    }
}

echo            '</div>'; //Close Accordion wrapper for Categories

echo        '</div><!--javascriptwrapper-->'; //Close Javascript wrapper

tmh2k1 on "Trouble with code inserted into site"

$
0
0

I recently removed a bunch of malware from our sites.

One of our sites looks like a bunch of redirects were inserted on the bottom of the page:

The page is:
bamboosalonsi.com

Would anyone know what file i my wordpress install (I am assuming it is a php file) that I can find these links, to remove them?

Thanks.

Joy on "Wordpress search function displaying all my posts (wrong results)"

$
0
0

I'm trying to include a search bar in my website's footer using
<?php get_search_form(); ?>

Unfortunately, regardless of what keyword I search, all my posts come up in the search results! You can try it here: http://ratanak.org/aatest

The code for my search form is as follows:

<form action="<?php bloginfo('siteurl'); ?>" id="searchform" method="get">
     <fieldset>
         <label for="s" class="screen-reader-text">Search for:</label>
         <input type="search" id="s" name="s" placeholder="Enter keywords" required />
         <input type="image" id="searchsubmit" alt="Search" src="<?php bloginfo( 'template_url' ); ?>/images/searchicon.png" />
     </fieldset>
</form>

Any help to make the search bar actually search my posts and pages would be much appreciated!

PJC Imagery on "Help with a Hack"

$
0
0

Hi I need help getting an unauthorized text/link hack off my website. My website is at pjcimagery.com and I'm using a WP theme from Themeforest called eClipse Photo Portfolio. The text that got hacked into all my pages is "installment loans davenport ia".

Here's the source code installment loans davenport ia

This text didn't show up until I transferred my site from Startlogic to Inmotion hosting. I transferred my site and updated my plugins including WP 4.1 pretty much at the same time, after which the text showed up. I contacted my host and they think it's in the eClipse theme. eClipse theme support claims it's in WordpPress.

I need to get this off my site. I'm very, very novice using WordPress and code. Please help, thanks.

rikavon on "GET-POST variables + AJAX"

$
0
0

Ok so, my case goes like this - I've got 2 simple dropdowns in a html page i created and embedded into one of my wordpress pages.. every time u select something out of the dropboxes it sends a simple AJAX request (through xmlhttp.open) and requests getResults.php with 2 $_GET[] variables (first and second dropdown values).

getResults.php returns some kind of table within the same page and all this process works just fine.

my question is - what should i do in case i want to run a google adwords campaign to this specific page but also send these two get variables within the url itself.. i mean, is there any way i could make some url rewrites so mydomain.com/helix-tragus will lead to this requested page but formed like mydomain.com/getResults.php?p=helix&q=tragus ?

thanks in advance.. hope i was clear enough..


jawanet on "Change search url (s) to custom"

andro1d_pl on "Add custom image fields in edit user profile"

$
0
0

Hi!

I want to send a picture for the server/ftp from editing a user profile, and I want to save the image location(after upload photo) in usermeta this person with 3 mouse click:

Upload Image(button) –> Select one image from disc space –> Update Profile(button)

Media library for me may not exist, the picture does not have to pass through it. Would have been nice if the location of the file after sending it to the server to save the user's usermeta.

How i can make my "profile gallery" like this:
http://i.imgur.com/TgUMAd7.jpg?1

Greetings
andro1d_pl

stnick on "Use pre_get_posts or wp_query"

$
0
0

Hello,

I'm creating a page that puts needs to put two post types and several categories in different sections of the page:

- 1 post carrying the tag 'featured' should be on the top in a featured div section.

- After this, a custom post type (events) should show 5 posts in its own div.

- Then, only the most recent or sticky post of each category of the 'post' type should be shown in its own div section. ( Imagine four columns, each representing the most recent post or sticky post from that category).

- Last but not least, the normal loop, so including all categories, should be shown, again in its own div.

I was wondering whether this setup would be possible to do with get_posts() and if this is the better option of the two. I'm fairly new to altering the loop (I'm a front-end guy), so some help would be greatly appreciated.

If my explanation is insufficient, please consult this link for a wireframe:
http://community.flagshipwp.com/uploads/default/82/b8c463448291b0a9.png

destinedjagold on "Adding a "thank you" pop-up after submitting comments"

$
0
0

Hello and good day.

As the title states, is it possible?
I've been searching around but couldn't find a solid answer for it.

I want that after a user submits a comment, the page will refresh (it does refresh by default) but then there will be a pop-up message that his comment has been sent.

I also want that if the user refreshes the page, the pop-up message will not appear.

Thanks~

Pepe Huerta on "Embed the new Google Maps without a plugin or shortcode"

$
0
0

Hi,

There are a lot of tutorials about embedding Google Maps in your posts, but after a long and painful research, I notice that every single tutorial was about embedding **THE OLD** Google Maps platform... the one with the url scheme 'maps.google.com'.

**THE NEW** Google Maps scheme (https://www.google.com/maps/place/) is completely different, and there almost no documentation on how to make it work in WordPress.

So, here is a quick tutorial on how to embed **THE NEW** Google Maps in WordPress posts without a plugin and just pasting the map url in the post body:

1. First, you need an API Key from Google. Follow the instructions at https://developers.google.com/maps/documentation/embed/guide#api_key.

2. Once you have your API Key, we can get into the code. In your favorite theme, open functions.php and add:

<?php
wp_embed_register_handler( 'googlemapsv1', '#https?://www.google.com/maps/place/(.*?)/#i', 'wpgm_embed_handler_googlemapsv1' );
function wpgm_embed_handler_googlemapsv1( $matches, $attr, $url, $rawattr ) {
	if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
		$width  = (int) $rawattr['width'];
		$height = (int) $rawattr['height'];
	} else {
		list( $width, $height ) = wp_expand_dimensions( 425, 326, $attr['width'], $attr['height'] );
	}
	return apply_filters( 'embed_googlemapsv1', "<iframe width='{$width}' height='{$height}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://www.google.com/maps/embed/v1/place?q=" . esc_attr($matches[1]) . "&key=***YOUR-API-KEY***'></iframe>" );
};
?>

Be sure to replace ***YOUR-API-KEY*** with your KEY. Save & close.

3. Test the new code by adding a new post and just pasting a google maps url like this one from The White House:

https://www.google.com/maps/place/The+White+House/@38.896278,-77.0306687,17z/data=!3m1!4b1!4m2!3m1!1s0x89b7b7bcdecbb1df:0x715969d86d0b76bf

That works the same way as just using:
https://www.google.com/maps/place/The+White+House/

The RegEx can be tweaked to allow different URL schemes for the four new modes, detailed here: https://developers.google.com/maps/documentation/embed/guide#modes.

This method only works for 'place' mode, but reading the documentation will get you on track to make the 'directions', 'search' and other modes working.

That's it. I hope it works for you guys (and excuse my english). Any contributions for the code will be appreciated.

cjdsie on "Add create page functionality to Nav Menus page"

$
0
0

Is there a way to add post new page functionality to the Nav Menus page in the admin panel?

And is it possible to add taxonomy to nav menus also in the admin panel?

bhunt504 on "Display only the most recent "sticky" post on a template page"

$
0
0

I have a template page that I'm trying to show the most recent "sticky" post for single category. I've found several solutions in the forums but none of them have been clear or I've been misunderstanding where to put the code in my setup to make this work. The code I'm using for the query is below. Any help would be greatly appreciated!!

<?php $my_query = new WP_Query( 'category_name=healthcare&posts_per_page=1' );
	while ( $my_query->have_posts() ) : $my_query->the_post() ;
	$do_not_duplicate = $post->ID;
	$thumb_id = get_post_thumbnail_id();
	$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
	$thumb_url = $thumb_url_array[0];
	?>

And this is a link to the particular page I'm working on: http://brandondhunt.org/bdrpartners/projects/


awheelthing on "Hached WP website, non-technical user"

$
0
0

Late last year, my Wordpress based website (I also have a Wordpress blogsite) was hacked, with a redirection code to a pharmaceutical supply service. A colleague whom is also my webhost has, apparently, been in contact with them in order to track and clean the site. A partial move was done, in that a new password was supplied but it still redirecys from an archive dpage, not from the main page as before. I've installed Wordfence which has blocked and informed of attempted logins but, of course, hasn't cleaned the code.
I am by no measure technically illiterate but the methods offered by Wordpress to do a full un-and re-install are beyond my skills.
The site name is "www.awheelthing.com", any and all assistance in finding the code and cleaning it is deeply appreciated.

frankjackson on "Having a problem with relative path to /wp-content/uploads/ (( I think ))"

$
0
0

Howdy, can anyone see a problem with this code?

I suspect I'm doing the relative url to the /wp-content/uploads/ wrong but can't figure it out.

<div class="image_wrap">
<?php
$posttags = get_the_tags(); // Get articles tags
$home = get_bloginfo('url'); // Get homepage URL

// Check if tag-slug.jpg exists and display it.
if ($posttags) {
 foreach($posttags as $tag) {
       $image = "/wp-content/uploads/$tag->slug.jpg";

       if (file_exists("wp-content/uploads/$tag->slug.jpg")) {
         echo '<a href="' . $home . '/' . $tag->slug . '" /><img title="' . $tag->name . '" alt="' . $tag->name . '" src="' . $image . '" /></a>';

       // If no image found, output something else.
       } else { ?>
         <img src="<?php bloginfo('template_directory'); ?>/img/default-author.jpg" title="  image missing  " />
       <?php }
  }
}
?>
</div><!-- #image_wrap -->

The output IS showing the default-author.jpg as it should if it can't find an image in the folder with the same name as the tag slug ... that's why I suspect my relative url structure is wrong here ... because the 'uploads' folder does have those images in it.

For example:

If the tag slug is 'frank-jackson' it should find and display the 'frank-jackson.jpg' image in the 'wp-content/uploads' folder, wrapped in a link pointing to that tag page.

Note: I'm using a 'no tag slugs in url' plugin, so that's why I don't have /tags/ in that output/echo url.

Earlier, before I added the 'else show default image part' it WAS outputting a <img> wrapped in a proper link to the tag page as it should, but just wasn't showing the image.

I think I'm just not sending it on the proper path the to wp-content/uploads directory because all the other parts seems to be working.

Thanks

[+

]

chris_digi on "Homepage.php Navigation help for (working) thumbnail listing"

$
0
0

I've repurposed my homepage.php to display a grid of images, each linking to their relevant post. I've then used homepage.php as a "Page" template, to give it a fixed URL. It looks great for my needs, also serving as a hacky archive, however page navigation no longer works.

I'd like to find a simple next/previous page OR page numbering solution. Any help would be much appreciated, (and no plugins please).

Here's my code (minus any navigation). Thank you!!

<?php
//Template Name: Home
get_header()
?>
<div class="container">
<header>
<!--<h1><?php echo get_option('tiny_head_title') ?></h1> -->
<!--<p><?php echo get_option('tiny_head_description') ?></p>-->
</header>

<?php $paged = get_query_var('page'); ?>

<?php $home = new WP_Query(array('post_type'=> 'post', 'posts_per_page' =>8, 'paged' => $paged)); ?>

<?php if($home->have_posts()): ?>

<div class="posts">
<?php while($home->have_posts()) : $home->the_post(); ?>
<div class="archivemother"><div class="archivethumb"><?php agentwp_print_post_title(); ?></div></div>
<!-- <?php the_excerpt() ?> -->

<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
<?php get_footer()?>

Anand Pratap on "How to secure website from hacking"

$
0
0

Hello Guys I want to make my website . I can develop theme easily.
But I don't know how to secure our website from hacking. Please suggest me the way to secure website from hacking as well as virus.

LjasonH on "WP nonce on Admin Tables"

$
0
0

Ello.

I have created some admin tables within my plugin, and now I'm looking to verify it when actions are used.

How would I set the nonce for the admin table (use wp_nonce_field within the form, or use wp_create_nonce when I create the action link)?

$mynonce = wp_create_nonce('name-i-set');
I do something like "&_wpnonce=$mynonce" but when I go to verify
wp_verify_nonce($_REQUEST['_wpnonce'], "name-i-set") it fails.

How would I go about setting the right nonce in the first place?
Google isn't helping at all, nor are the docs.

Just to note: I am checking the nonce within my table page, not the table extended class.

- Jay.

Viewing all 8245 articles
Browse latest View live




Latest Images