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

jmlmj on "auto logout in custom child theme"

0
0

Hi there,

I'm looking to create a situation whereby a user who is logged in via a specific IP is automatically logged out after N number of minutes of inactivity.

Is this possible?

I know that there are some plugins to do this, but I was hoping on doing it with my child theme. I have the following in the functions.php file:

$login_time_ms = (1000 * 60) * 120; //2 hrs
function academicachild_timeout($expiration, $user_id, $remember){
    return $remember ? $expiration : $login_time_ms;
}
add_filter('auth_cookie_expiration', 'academicachild_timeout', 99, 3);

...But it seems that as soon as I enable that, no one can log in (including admin).
Any clues?

Thanks!


5ngua on "2 wordpress install share the same users database"

0
0

I have 2 wordpress + buddypress + bbpress sites running independently but I want them to share the same users database. Just like buddypress.org users will use wordpress.org account to login... What's solution for that?

M1chel on "creating a custom field that outputs a list"

0
0

Hi,

I'm building a site for a client and trying to make things as simple as possible for him through a customized user panel.

In a blog post which will actually be a product page for his products I need to create a custom fields that outputs a ul list like this:

Material: wood
Height: 100 cm
Width: 10 cm
Lenght: 70 cm

but I'm not sure about how to do it.

I did a search online and someone suggested to create a normal custom field with every element to list to be separated by a comma and use php to divide them in a list. It could be a solution but I don't know how to code that in php.

A visual separation in the post panel would also be easier for my client, adding each element in a field and then get the list ready on the website.

Can you help me? :)

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.

Ivan Jaquez on "Clickable Custom Header Image For Each Category"

0
0

Hello guys! Is there a plugin or method to get unique header image for each category, all clickable to an specific url,not just the home page?

For example: Dog training header linked to an external dog training site.

Thanks in advance!

shiasapir on "Display custom taxonomy based on custom meta box selection"

0
0

I have a custom post type called "deli" and I have a custom taxonomy for this cpt called "deli-brands".

For "deli" cpt I created a meta box (select radio) with two different options "imported" and "domestic".

I need to display the taxonomies "deli-brands" based on the cpt meta box selection.

ie. If I have taxonomies "Brand 1", "Brand 2" and "Brand 3", and post type called "Product 100" with meta box "domestic" selected and taxonomy "Brand 2" selected. I want to display on the page the taxonomy or taxonomies that have posts with "domestic" meta box selected. In this example, the result will be display on the page "Brands 2" taxonomy only.

Does any body did something like this before?! Is it possible?!

NovaSev on "Filters....I think..."

0
0

So I'm using the wp_login_form(). All of it's working swell but...

Here's my issue - I want to change the class that is automatically populated with it's submit button. I've done so by just changing the class in the wp-includes/general-template.php but I'm sure that gets written over again once I have to update wordpress. Can I do a filter for this? Is there a good link that you can provide that will show me how to create a filter for this and possibly other things as well?

I'm a bit new to php so this may be really simple .... thanks for the help.

sixfootjames on "AND and OR query in WordPress wpdb"

0
0

I have read through the entire wpdb and ezSQL so I have a very good understanding of what the wpdb class can do...essentially wpdb is to SQL what jQuery is to Javascript!

I am not an SQL developer but my understanding is that WP_Query cannot do AND and OR queries which is what I need.

Here's my requirements. The final outcome should be that if a user selects from the ProductType dropdown and clicks the search button, the page should return the results based on that term from the select menu. If they select an option from ProductGroup and hit the search button then the results need to return based on the selection.

If both dropdown menus have options selected, both ProductType and ProductGroup needs to be queried and the results returned. So it needs to be an AND or OR query that returns the results and not just one or the other.

This would be my pseudo code attempt.

If ProductType selected
   Return all ProductTypes

If ProductGroup selected
   Return all ProductGroups

If ProductType AND ProductGroup selected
   Return filtered ProductTypes and ProductGroups

I'd appreciate some help with this as SQL is no my "first" language :) Thank you.


Richard Bui on "Showing all thumbnails of an attached post"

0
0

So I found this code in the support forum here and it does 95% of what I want, but for the life of me, I can't figure out the last 5%. So here's the code I'm using: http://pastebin.com/1vTHaHSB. It works perfectly. Now the only issue is, I want to be able to wrap it in a DIV like <div id="show-all-thumbs"> or something and also wrap each of the $thumblist in a <li> or something.

Can anyone help? Thanks!

wilkyboy2 on "Custom Wordpress author names"

0
0

Hi All,

I am migrating my school's Online Newspaper from Joomla to Wordpress, and I am trying to modify the theme (Twenty Fourteen), so that it uses a metadata key value as the display name for a post (since most of the content creators have had their posts submitted to the old site using an editor as a proxy, so their names are stored as 'author aliases').
It should be as simple as:

if (author_id = 0) {
    $author_name = $meta['alias'];
}

My awesome php simplification
But where should this be implemented within the vast expanse of wordpress code.

I would also greatly appreciate being shown how to configure all of the other author related perks (list author posts, these authors have contributed etc.)

I would show you the site in situ, but unfortunately it is running on my local dev machine. Not that seeing it would help at all.

any help at all would be greatly appreciated!

-- Wilky

vbmark on "How to apply "Pretty Permalinks" to standalone page?"

0
0

I have turned on "Pretty Permalinks" and it works great. However, I created a standalone php page, e.g. cars.php and right now it shows up as:

http://www.example.com/cars.php

How can I make it show up like the URLs for the pages in Wordpress like this:

http://www.example.com/cars/

Is this something that needs to be done .htaccess or do I need to write something into a Wordpress PHP file?

Thanks!

malkah on "remove rel=nofollow from bbpress"

0
0

Hi

Is there a way to remove the rel=nofollow from bbpress posts?

thanks

IllustrateMyDesign on "Contact Form-Admin Only Section"

0
0

I was wondering if there was any contact form or plugin with a section that only the admin can access, like an "office use only" section.

For example a contact form with a "hidden section" that only the admin can access. The visitor fills out the form, and then I fill out the rest afterward.

Sorry if this doesn't make sense.

Any suggestions?

vbmark on "How to insert data into custom meta table"

0
0

Hello,

I have a custom meta table I created named carsmeta. I copied the table structure from another meta table.

How do I insert data into this table? I tried using add_metadata

add_metadata( 'carmeta', 1, "Ford", "Blue" );

but that doesn't work.

Also, what is the best way to structure/format the data for the value?

Thanks!

wedideas on "How can i save a Wordpress checkbox array in a widget?"

0
0

I'm writing a plugin/widget that will enable a user to pick some specific posts from a list of checkboxes returned from a WP get_posts query.

I've written the following code but for some reason I can't get the checkbox values to stick - the options are either all on or all off. If I select one or more of the checkboxes, they all end up checked - I presume because they aren't being written as an array but have no idea how I can update the separate values?

<?php
/*
Plugin Name: Hot Topics
Plugin URI: http://www.weddingideasmag.com
Description: Use this widget to choose an array of posts snippets to show
Version: 1.0)
Author: James Payne
Author URI: http://www.bluntcreative.co.uk
License: GPL2
*/

// register widget
add_action('widgets_init',
     create_function('', 'return register_widget("HotTopics");')
);

class HotTopics extends WP_Widget {

///////////////////////////
// Initialise the widget //
/////////////////////////// 

    function HotTopics() {
        $this->WP_Widget(
            'hottopics',
            __('Hot Topics'),
            array(
                'name' => 'Hot Topics',
                /*'classname' => 'widget-hot-topics',*/
                'description' => __( "Use this widget to choose an array of posts snippets to show in the sidebar." )
            )
        );
    }

    /**
     * Outputs the content of the widget
     *
     * @param array $args
     * @param array $instance
     */
    public function widget( $args, $instance ) {
        // outputs the content of the widget
    }

    /**
     * Ouputs the options form on admin
     *
     * @param array $instance The widget options
     */
    public function form ($instance) {

      $instance = wp_parse_args( (array) $instance, $defaults ); 

      // Populate the select list with the post titles
        $get_posts = array('1'=>'First option','2'=>'Second option','3'=>'Third option','4'=>'Fourth option','5'=>'Fifth option',);

        foreach( $get_posts as $post ) { ?>

        <p><input type="checkbox" id="<?php echo $this->get_field_id('rss'); ?>" name="<?php echo $this->get_field_name('rss'); ?>[]" <?php if ($instance['rss']) echo 'checked="checked"' ?> />
       <label for="<?php echo $this->get_field_id('rss'); ?>"><?php echo $post; ?></label></p>

        <?php }

    }

    /**
     * Processing widget options on save
     *
     * @param array $new_instance The new options
     * @param array $old_instance The previous options
     */
    public function update ($new_instance, $old_instance) {
      $instance = $old_instance;
      $instance['rss'] = $new_instance['rss'];

      return $instance;
    }
}
?>

rachelbilski on "Password Protected Posts only for Logged Out Users"

0
0

I have a number of posts, most can only be viewed by a logged in user, but some are password protected for both logged in and non-logged in users to view.

I need to have the password protected posts so that only non-logged in users need to enter the password, for logged in users the post should just be visible, but I can't seem to manage this, they still need to enter the password.

Any ideas?

ced1870 on "customize the admin screen of a plugin"

0
0

Hi
I'm new to wordpress and I'm playing with my new toy :)
I'm trying to create a plugin, it is ok for the first steps. Now I have menu entry with a specific post_type and when editing the items I would like to not have the standard layout.
Instead of "edit item, new" and the default fields , I would like to create my own PHP/HTML/CSS layout to give more control and options.
As I'm new I don't know how to do that, may be someone here can help me and give me few suggestions :)
Thank you !
CEd

jeich on "get_queried_object no longer working with pre_get_posts and pretty permalinks"

0
0

Hi!

We are experiencing the category issue referenced here ->https://core.trac.wordpress.org/ticket/26627

We applied '3.8.1' and the issue is still unresolved.

The custom query is operable with the default permalink (?cat=) option set. Our mobile barcode scan now returns the homepage. Does anyone feel up to a challenge?

alisalem on "Only Admins and the post author can view a post, is it possible?"

0
0

Hello,

I have a site where my clients click on New Order icon then fill up some form (jquery) and this order will be consider as a post so the orders look like this:

http://www.mysite.com/order-1
http://www.mysite.com/order-2
http://www.mysite.com/order-3
http://www.mysite.com/order-3

Now, everyone could see the order details by pasting the links above in their browsers. I want to restrict the post visibility to admins and the client only, I know there's a way to keep posts password restricted by a password, but I wonder if it's possible to have only the admin and logged in client see his/her order for example :
http://www.mysite.com/order-2

I try to find an available plug in but I could not find any. my question is, is it difficult t make? and how much it would usually cost to make a customized plug in like that.

Thanks
A

benutzerfreund on "Loading template twice - how to do it?"

0
0

I have a template that I'd like to use several times on a page. I use
include( get_stylesheet_directory() . '/ads.php');
and this works for the first instance. But on the second it doesn't. Apparently it is only possible to include it once. So I tried:
locate_template( array( 'ads.php' ), true, false );
But to no avail. And get_template_part doesn't do the trick either.

Which is the correct way to do it? (I want do use it in the Loop, to include a block of ads every 3rd post on my homepage.)

Viewing all 8245 articles
Browse latest View live




Latest Images